ExistingOfflineExperiment
ExistingOfflineExperiment¶
Existing Offline Experiment allows you to report information to an experiment that already exists on comet.ml, is not currently running, but capture the logging information for later upload. This is useful when your training and testing happen on different scripts, and you have a unreliable connection to the Comet.ML server.
For example:
train.py:
exp = Experiment(api_key="my-key")
score = train_model()
exp.log_metric("train accuracy", score)
Now obtain the experiment key from comet.ml. If it's not visible
on your experiment table you can click Customize
and add it as a
column.
test.py:
exp = ExistingOfflineExperiment(
api_key="my-key",
previous_experiment="your experiment key from comet.ml",
offline_directory="./",
)
score = test_model()
exp.log_metric("test accuracy", score)
Alternatively, you can pass the api_key via an environment
variable named COMET_API_KEY
and the previous experiment id via
an environment variable named COMET_EXPERIMENT_KEY
and omit them
from the ExistingOfflineExperiment constructor:
exp = ExistingOfflineExperiment()
score = test_model()
exp.log_metric("test accuracy", score)
ExistingOfflineExperiment.url¶
Get the url of the experiment.
Example:
```python
api_experiment.url "https://www.comet.ml/username/34637643746374637463476" ```
ExistingOfflineExperiment.__init__
¶
python
__init__(self, api_key=None, previous_experiment=None, **kwargs)
Continues an Comet.ml experiment.
Uses the same arguments and keywords as Experiment and OfflineExperiment:
Args:
- previous_experiment: Your experiment key from comet.ml
- offline_directory: the directory used to save the offline archive for the experiment.
Note: ExistingOfflineExperiment does not alter nor destroy previously logged information. To override or add to previous information you will have to set the appropriate following parameters to True:
- log_code
- log_graph
- parse_args
- log_env_details
- log_git_metadata
- log_git_patch
- log_env_gpu
- log_env_cpu
- log_env_host
For example, to contiue to collect GPU information in an
ExistingOfflineExperiment
you will need to override these parameters:
```python
experiment = ExistingOfflineExperiment( ... log_env_details=True, ... log_env_gpu=True) ```
You can also set the previous_experiment
via COMET_EXPERIMENT_KEY
in the
Comet Config Variables.
Likewise, you can also set the offline_directory
in the
Comet Config Variables.
See also: