OfflineExperiment() interface allows you to log your experiment data on your local disk until you are ready to upload it from memory to Comet.ml.
To use the offline support, import the OfflineExperiment class at the top of your script rather than
Experiment, like this:
from comet_ml import OfflineExperiment
Experiment()creation line. You need to switch
OfflineExperiment, take out the API Key argument (if you pass it directly to Experiment), and add the
offline_directoryargument at the end of the argument list.
Here is an example using
from comet_ml import Experiment experiment = Experiment(MY_API_KEY, workspace="WORKSPACE_NAME", project_name="PROJECT_NAME",...)
from comet_ml import OfflineExperiment experiment = OfflineExperiment( workspace="WORKSPACE_NAME", project_name="PROJECT_NAME",..., offline_directory="/tmp")
Finally, launch your machine learning script as usual. The
OfflineExperiment output will slightly differ from using the
Experiment object. Specifically, the SDK won’t show a URL anymore. At the end of the script, the SDK will show a message similar to this to tell you where the offline experiment has been saved, and how to upload it:
COMET INFO: To upload this offline experiment, run: /usr/bin/python -m comet_ml.scripts.comet_upload /tmp/comet/a3e24ed1ed07477693c1c5c05507f216.zip
You can tell an
OfflineExperiment from an
Experiment because Comet automatically issues an
experiment.log_other("offline_experiment", True) when using an offline experiment.
To upload your OfflineExperiments to Comet.ml, execute the following command in your command line:
$ comet upload /tmp/comet/5da271fcb60b4652a51dfc0decbe7cd9.zip
To read more about
comet upload please see Command-Line Utilities.