1517f6e321aee8e78aac0133e9d05cfcef0b42b0,base/base_trainer.py,BaseTrainer,__init__,#BaseTrainer#Any#Any#Any#Any#Any#Any#Any#,15

Before Change



        // setup GPU device if available, move model into configured device
        n_gpu_use = config["n_gpu"]
        n_gpu = torch.cuda.device_count()
        if n_gpu_use > 0 and n_gpu == 0:
            self.logger.warning("Warning: There\"s no GPU available on this machine, training will be performed on CPU.")
            n_gpu_use = 0
        if n_gpu_use > n_gpu:
            msg = "Warning: The number of GPU\"s configured to use is {}, but only {} are available on this machine.".format(n_gpu_use, n_gpu)
            self.logger.warning(msg)
            n_gpu_use = n_gpu
        self.device = torch.device("cuda:0" if n_gpu_use > 0 else "cpu")
        self.model = model.to(self.device)
        if n_gpu_use > 1:
            self.model = torch.nn.DataParallel(model, device_ids=list(range(n_gpu_use)))

        self.loss = loss
        self.metrics = metrics

After Change


        self.logger = logging.getLogger(self.__class__.__name__)

        // setup GPU device if available, move model into configured device
        self.device, device_ids = self._prepare_device(config["n_gpu"])
        self.model = model.to(self.device)
        if len(device_ids) > 1:
            self.model = torch.nn.DataParallel(model, device_ids=device_ids)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: victoresque/pytorch-template
Commit Name: 1517f6e321aee8e78aac0133e9d05cfcef0b42b0
Time: 2018-10-16
Author: sunq0313@gmail.com
File Name: base/base_trainer.py
Class Name: BaseTrainer
Method Name: __init__


Project Name: mozilla/TTS
Commit Name: d6b9a5738af8c6dbe642b2464b4fec31c306aaa7
Time: 2020-06-15
Author: erogol@hotmail.com
File Name: vocoder/train.py
Class Name:
Method Name:


Project Name: mozilla/TTS
Commit Name: e051dd41b18fed43a71c9d6b7280548184fd3341
Time: 2020-06-02
Author: erogol@hotmail.com
File Name: vocoder/train.py
Class Name:
Method Name: