def train_inception_opp(): print("Running Opportunity") device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") model = InceptionModel(num_blocks=1, in_channels=113, out_channels=32, bottleneck_channels=2, kernel_sizes=20, use_residuals=True, num_pred_classes=17) model.to(device) trainer = OPPTrainer(model=model) #trainer.fit() wandb.agent(sweep_id, function=trainer.fit, count=15)
def train_inception_har(): print("Running HAR") data_folder = Path('../data/UCI_HAR_Dataset') device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") print(device) model = InceptionModel(num_blocks=1, in_channels=9, out_channels=32, bottleneck_channels=2, kernel_sizes=20, use_residuals=True, num_pred_classes=6) model.to(device) trainer = HARTrainer(model=model, data_folder=data_folder) #trainer.fit() wandb.agent(sweep_id, function=trainer.fit, count=648)
def train_inception_wisdm(): print("Running WISDM") device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") model = InceptionModel(num_blocks=1, in_channels=3, out_channels=32, bottleneck_channels=2, kernel_sizes=20, use_residuals=True, num_pred_classes=6) model.to(device) trainer = WISDMTrainer(model=model) trainer.fit() savepath = trainer.save_model() #savepath = Path("data/models/InceptionModel/InceptionModel_model_wisdm_20_epochs.pkl") new_trainer = load_wisdm_trainer(savepath) new_trainer.evaluate()
def test_fit_works_for_single_and_multiclass(self, tmp_path, num_pred_classes): in_channels = 30 model = InceptionModel(2, in_channels, out_channels=30, bottleneck_channels=12, kernel_sizes=15, use_residuals=True, num_pred_classes=num_pred_classes) trainer = TrainerForTests(model, tmp_path, in_channels, num_preds=num_pred_classes) # this just ensures everything runs trainer.fit(batch_size=50, num_epochs=1)
def train_inception_sc(): data_folder = Path('../data') model = InceptionModel(num_blocks=1, in_channels=1, out_channels=2, bottleneck_channels=2, kernel_sizes=41, use_residuals=True, num_pred_classes=6) trainer = UCRTrainer(model=model, experiment='synthetic_control', data_folder=data_folder) trainer.fit() savepath = trainer.save_model() new_trainer = load_ucr_trainer(savepath) new_trainer.evaluate()