示例#1
0
 def from_config(cls, config: Config, model: torch.nn.Module, *args,
                 **kwargs):
     # can't run hogwild on cuda
     if cuda.CUDA_ENABLED or config.num_workers == 1:
         return Trainer(config.real_trainer, model)
     return cls(config.real_trainer, config.num_workers, model, *args,
                **kwargs)
示例#2
0
 class Config(ConfigBase):
     real_trainer: Trainer.Config = Trainer.Config()
     num_workers: int = 1
示例#3
0
 def from_config(cls, config: Config, *args, **kwargs):
     # can't run hogwild on cuda
     if cuda_utils.CUDA_ENABLED or config.num_workers == 1:
         return Trainer(config.real_trainer, *args, **kwargs)
     return cls(config.real_trainer, config.num_workers, *args, **kwargs)