Running Offline

The 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:

python from comet_ml import OfflineExperiment Then change the Experiment() creation line. You need to switch Experiment to OfflineExperiment, take out the API Key argument (if you pass it directly to Experiment), and add the offline_directory argument at the end of the argument list.

Here is an example using Experiment:

```python from comet_ml import Experiment

experiment = Experiment(MY_API_KEY, workspace="WORKSPACE_NAME", project_name="PROJECT_NAME",...) ``` Here is what it would look like for switching to the offline training:

```python 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:

bash COMET INFO: To upload this offline experiment, run: /usr/bin/python -m comet_ml.scripts.comet_upload /tmp/comet/a3e24ed1ed07477693c1c5c05507f216.zip

Info

You can tell an OfflineExperiment from an Experiment because Comet automatically issues an experiment.log_other("offline_experiment", True) when using an offline experiment.

Uploading OfflineExperiments

To upload your OfflineExperiments to Comet.ml, execute the following command in your command line:

bash $ comet upload /tmp/comet/5da271fcb60b4652a51dfc0decbe7cd9.zip

To read more about comet upload please see Command-Line Utilities.