Last active
July 25, 2019 15:45
-
-
Save ben0it8/23b417c86a52adc088b469764fb6a0a2 to your computer and use it in GitHub Desktop.
fine-tune and evaluate model
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
# fit the model on `train_dl`" | |
trainer.run(train_dl, max_epochs=finetuning_config.n_epochs) | |
# save model weights | |
torch.save(model.state_dict(), os.path.join(finetuning_config.log_dir, "model_weights.pth")) | |
# evaluate the model on `test_dl`" | |
evaluator.run(test_dl) | |
print(f"Test accuracy: {100*evaluator.state.metrics['accuracy']:.3f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment