86cff17e7ef1b355e1ab4862ccd664ed4c856227,python/ray/util/sgd/torch/distributed_torch_runner.py,DistributedTorchRunner,_get_model_state_dicts,#DistributedTorchRunner#,140

Before Change


        
        cpu_state_dicts = []
        for model in self.models:
            state_dict = model.module.state_dict()
            // This is so that we create a duplicate of weights into CPU rather
            // than move the model weights out of the GPU so that we can
            // resume training while saving intermediate checkpoints.
            cpu_state_dicts += [{k: v.cpu() for k, v in state_dict.items()}]
        return cpu_state_dicts

    def _set_model_state_dicts(self, model_state_dicts):
        for model, model_state_dict in zip(self.models, model_state_dicts):

After Change



        This is needed for PyTorch DistributedDataParallel models.
        
        return [model.module.state_dict() for model in self.models]

    def _set_model_state_dicts(self, model_state_dicts):
        for model, model_state_dict in zip(self.models, model_state_dicts):
            model.module.load_state_dict(model_state_dict)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: ray-project/ray
Commit Name: 86cff17e7ef1b355e1ab4862ccd664ed4c856227
Time: 2020-03-30
Author: rliaw@berkeley.edu
File Name: python/ray/util/sgd/torch/distributed_torch_runner.py
Class Name: DistributedTorchRunner
Method Name: _get_model_state_dicts


Project Name: ray-project/ray
Commit Name: 86cff17e7ef1b355e1ab4862ccd664ed4c856227
Time: 2020-03-30
Author: rliaw@berkeley.edu
File Name: python/ray/util/sgd/torch/torch_runner.py
Class Name: TorchRunner
Method Name: _get_model_state_dicts


Project Name: ray-project/ray
Commit Name: 9c5e5a97576f9bb8c7d7256cd566cdd4bcd63a3f
Time: 2020-08-18
Author: mfitton@berkeley.edu
File Name: python/ray/tests/test_metrics.py
Class Name:
Method Name: test_raylet_info_endpoint