Created
August 23, 2020 21:23
-
-
Save mirth/af0ceb8ef619af3a3fd5e7a6f9b89d12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@baker.command | |
def run(batch_size=8, epochs=5, device='cuda'): | |
train_loader, val_loader = get_data_loaders(batch_size) | |
model = NoiseClassifier() | |
model = model.to(device) | |
model.eval() | |
optimizer = Adam(model.parameters()) | |
criterion = nn.BCELoss() | |
trainer = create_supervised_trainer(model, optimizer, criterion, device=device) | |
val_metrics = {"accuracy": Accuracy(), "loss": Loss(criterion)} | |
evaluator = create_supervised_evaluator(model, metrics=val_metrics, device=device) | |
# ... | |
# Here we are attaching loggers | |
# Look into the repository for full code | |
# ... | |
trainer.run(train_loader, max_epochs=epochs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment