Track, compare, and optimize your models with Comet.ml
Comet.ml is a hosted service that let you keep track of your machine learning experiments, visualize and compare results of each experiment. Furthermore, Comet.ml provides an AutoML feature that let’s you find the best hyper-prameters to train your model. And it’s super easy to use, you simply initialize an experiment, Comet.ml will patch your code and add logging functionality. For instance it will automatically add callbacks to your Keras model.fit
to log the training metrics and update update the experiment dashboard.
Install Comet.ml
pip install comet_ml -q
Setup Comet.ml:
- Login to the service https://comet.ml/ and and get an API key
- Initialize a new experiment with project names and additional flags
from comet_ml import Experiment
COMET_API_KEY = 'xyz'
experiment = Experiment(
api_key=COMET_API_KEY,
project_name="<project-name>", workspace="<username>",
auto_param_logging=True, auto_metric_logging=True
)
Initialize Comet.ml config to saves hyperparameters and inputs of the expriment
config = {
'batch_size': 1024,
'train_split': 0.8
}
experiment.log_parameters(config)
After creating the model, you can upload model plot
model = ...
plot_model(model, to_file='model.png', show_shapes=True)
experiment.log_image('model.png')
After training finishes, you can upload the model and its weights
model.fit(train_ds, validation_data=valid_ds, epochs=10)
model.save('<model-name>.h5')
experiment.log_model('<model-name>', '<model-name>.h5', overwrite=True)
Learn more about what you can do with Comet - link.