5fadb9c18e3de16cc5633175199f9e9e2c381102,rl_coach/graph_managers/graph_manager.py,GraphManager,restore_checkpoint,#GraphManager#,493

Before Change


            checkpoint = tf.train.get_checkpoint_state(checkpoint_dir)
            screen.log_title("Loading checkpoint: {}".format(checkpoint.model_checkpoint_path))
            variables = {}
            for var_name, _ in tf.contrib.framework.list_variables(checkpoint_dir):
                // Load the variable
                var = tf.contrib.framework.load_variable(checkpoint_dir, var_name)

                // Set the new name
                new_name = var_name
                new_name = new_name.replace("global/", "online/")
                variables[new_name] = var

            for v in self.variables_to_restore:
                self.sess.run(v.assign(variables[v.name.split(":")[0]]))

    def occasionally_save_checkpoint(self):

After Change



        // TODO: find better way to load checkpoints that were saved with a global network into the online network
        if hasattr(self.task_parameters, "checkpoint_restore_dir") and self.task_parameters.checkpoint_restore_dir:
            if self.task_parameters.framework_type == Frameworks.tensorflow:
                self._restore_checkpoint_tf(self.task_parameters.checkpoint_restore_dir)
            elif self.task_parameters.framework_type == Frameworks.mxnet:
                // TODO implement checkpoint restore
                pass
            else:
                raise ValueError("Invalid framework {}".format(self.task_parameters.framework_type))

    def occasionally_save_checkpoint(self):
        // only the chief process saves checkpoints
        if self.task_parameters.checkpoint_save_secs \
                and time.time() - self.last_checkpoint_saving_time >= self.task_parameters.checkpoint_save_secs \
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: NervanaSystems/coach
Commit Name: 5fadb9c18e3de16cc5633175199f9e9e2c381102
Time: 2018-11-07
Author: sina.beh@gmail.com
File Name: rl_coach/graph_managers/graph_manager.py
Class Name: GraphManager
Method Name: restore_checkpoint


Project Name: ray-project/ray
Commit Name: 1d532d1cb8b829bdf7055a22c206032ca0b72e46
Time: 2020-04-02
Author: rkooo567@gmail.com
File Name: python/ray/dashboard/metrics_exporter/schema.py
Class Name: BaseModel
Method Name: parse_obj


Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: examples/model_compress/slim_torch_cifar10.py
Class Name:
Method Name: main