Как экспортировать SavedModel, используя оценщик с крупномасштабным внедрением в ParameterServerStrategy? - PullRequest
0 голосов
/ 08 ноября 2019

Я считаю, что tf.estimator необходимо загрузить всю модель в оценщик из файла контрольных точек для экспорта SavedModel. Но когда мы обучаем модель с крупномасштабным внедрением, используя ParameterServerStrategy, мы можем не загрузить модель, потому что размер модели может превысить память оценщика. Итак, как в этом случае экспортировать SaveModel с помощью API оценки?

https://github.com/tensorflow/estimator/blob/8c573ba86938a394e036a0376ea29e302d9534ad/tensorflow_estimator/python/estimator/estimator.py#L951-L969

   with tf_session.Session(config=self._session_config) as session:

        if estimator_spec.scaffold.local_init_op is not None:
          local_init_op = estimator_spec.scaffold.local_init_op
        else:
          local_init_op = monitored_session.Scaffold.default_local_init_op()

        # This saver will be used both for restoring variables now,
        # and in saving out the metagraph below. This ensures that any
        # Custom Savers stored with the Scaffold are passed through to the
        # SavedModel for restore later.
        graph_saver = estimator_spec.scaffold.saver or saver.Saver(sharded=True)

        if save_variables and not check_variables:
          raise ValueError('If `save_variables` is `True, `check_variables`'
                           'must not be `False`.')
        if check_variables:
          try:
            graph_saver.restore(session, checkpoint_path)
...