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)
class Config(ConfigBase): real_trainer: Trainer.Config = Trainer.Config() num_workers: int = 1
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)