_DEFAULT_KERNEL_SIZES, _DEFAULT_NUM_LAYERS, _DEFAULT_SKIPS) trainer = PyTorchImageClassificationTrainer( base_model, dataset_cls="CIFAR10", dataset_kwargs={ "root": "data/cifar10", "download": True }, dataloader_kwargs={"batch_size": 32}, optimizer_kwargs={"lr": 1e-3}, trainer_kwargs={"max_epochs": 1}) # new interface applied_mutators = [] applied_mutators.append(BlockMutator('mutable_0')) applied_mutators.append(BlockMutator('mutable_1')) simple_startegy = TPEStrategy() exp = RetiariiExperiment(base_model, trainer, applied_mutators, simple_startegy) exp_config = RetiariiExeConfig('local') exp_config.experiment_name = 'mnasnet_search' exp_config.trial_concurrency = 2 exp_config.max_trial_number = 10 exp_config.training_service.use_active_gpu = False exp.run(exp_config, 8081)
test_dataset = serialize(CIFAR10, root='data/cifar10', train=False, download=True, transform=valid_transform) # trainer = pl.Classification(train_dataloader=pl.DataLoader(train_dataset, batch_size=100), # val_dataloaders=pl.DataLoader(test_dataset, batch_size=100), # max_epochs=1, limit_train_batches=0.2) trainer = cgo.Classification(train_dataloader=pl.DataLoader( train_dataset, batch_size=100), val_dataloaders=pl.DataLoader(test_dataset, batch_size=100), max_epochs=1, limit_train_batches=0.2) applied_mutators = [BlockMutator('mutable_0'), BlockMutator('mutable_1')] simple_strategy = TPEStrategy() exp = RetiariiExperiment(base_model, trainer, applied_mutators, simple_strategy) exp_config = RetiariiExeConfig('remote') exp_config.experiment_name = 'darts_search' exp_config.trial_concurrency = 3 exp_config.max_trial_number = 10 exp_config.trial_gpu_number = 1 exp_config.training_service.reuse_mode = True rm_conf = RemoteMachineConfig() rm_conf.host = '127.0.0.1'
transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) valid_transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) train_dataset = serialize(CIFAR10, root='data/cifar10', train=True, download=True, transform=train_transform) test_dataset = serialize(CIFAR10, root='data/cifar10', train=False, download=True, transform=valid_transform) trainer = pl.Classification(train_dataloader=pl.DataLoader(train_dataset, batch_size=100), val_dataloaders=pl.DataLoader(test_dataset, batch_size=100), max_epochs=1, limit_train_batches=0.2) applied_mutators = [ BlockMutator('mutable_0'), BlockMutator('mutable_1') ] simple_strategy = TPEStrategy() exp = RetiariiExperiment(base_model, trainer, applied_mutators, simple_strategy) exp_config = RetiariiExeConfig('local') exp_config.experiment_name = 'mnasnet_search' exp_config.trial_concurrency = 2 exp_config.max_trial_number = 10 exp_config.training_service.use_active_gpu = False exp.run(exp_config, 8097)