Comet Onprem User Instructions¶
For those users that are running from an onprem version of
www.comet.ml
, you will need to have a couple of additional
configuration variables with the appropriate values.
Info
These variables may already be set for you by your onprem sysadmin. Please check with them to see if you need to set these yourself. If you do need to set them, you will need to know the values of these variables, described below.
If you do need to set them yourself, please follow these instructions.
First, you should make sure that you can import comet_ml
. If
comet_ml
is not installed, you can install it (and upgrade it) using
pip or conda. For more information, please see
Installation Instructions.
For the following examples, please replace comet.your-company.com
with your company's onprem installation URL or IP address.
You will need to know the following from your onprem sysadmin:
- COMET_URL_OVERRIDE
- COMET_OPTIMIZER_URL
Now, you can setup your environment through one of the two following methods.
Interactive Configuration¶
If you have the ability to answer questions interactively (say, through a command-line console, or in a Jupyter Notebook) then you can set the configuration variables (including your Comet API key) through this method. Otherwise, you will need to use one the of Manual Configuration options described below.
Once you know the values of the two environment variables, from a Python environment you can run:
python
import comet_ml
comet_ml.init_onprem()
And simply enter the values when prompted. If the variables have already been set, then this command will not ask you for any values. If you wished, you could include this in code that ran in an interactive environment (such as a script or notebook).
Likewise, you can run this process from the command line:
bash
comet init --onprem
By running this command, you will create a local ~/.comet.config file that will be used whenever you run a Comet experiment or use the Comet API. You can edit or remove this file if necessary.
If you make a mistake, or need to reset the variables in the future, you can
use the force
parameter:
python
import comet_ml
comet_ml.init_onprem(force=True)
Or:
bash
comet init --onprem --force
Manual Configuration¶
You can also set these variables and values using one of the following three methods:
1. Shell Environment Variable¶
You could put these variables and their values in a shell script which could be executed each time a user creates a new shell:
bash
export COMET_URL_OVERRIDE=http://comet.your-company.com/clientlib/
export COMET_OPTIMIZER_URL=http://comet.your-company.com/optimizer/
You can also set your personal COMET_API_KEY
in this manner, but we
suggest using the Comet Configuration option below.
2. Script Environment Variable¶
You could put these variables and their values in the script
itself. Note that the import comet_ml
comes after their setting:
```python import os
os.environ["COMET_URL_OVERRIDE"]="http://comet.your-company.com/clientlib/" os.environ["COMET_OPTIMIZER_URL"]="http://comet.your-company.com/optimizer/"
import comet_ml ```
You can also set your personal COMET_API_KEY
in this manner, but we
suggest using the Comet Configuration option below.
3. Comet Configuration File¶
You could put these variables and their values in a file named
./comet.config
in you home directory. Note that this is also a good
place for your personal Comet API key.
```ini [comet]
URL_OVERRIDE = http://comet.your-company.com/clientlib/ OPTIMIZER_URL = http://comet.your-company.com/optimizer/ API_KEY = ... ```
Testing¶
Once you have the above configuration parameters set through one of the three methods, you are now ready to test your setup.
Test Experiment¶
```python
Script: test_comet.py¶
from comet_ml import Experiment from time import sleep import random
experiment = Experiment(project_name="test-comet")
print("Setting and logging some items...") experiment.set_name("testing comet") experiment.add_tag("working!") experiment.log_other("finished", False)
print("Logging parameters...") experiment.log_parameter("param_A", 1.1) experiment.log_parameter("param_B", 2.2) experiment.log_parameter("param_D", "high") experiment.log_parameter("param_E", "low") experiment.log_parameter("param_F", True)
print("Logging metrics", end="") for y in range(60): experiment.log_metric("a", random.random() * y, step=y) experiment.log_metric("b", random.random(), step=y) experiment.log_metric("c", y, step=y) experiment.log_metric("d", y/60, step=y) print(".", end="") sleep(1.0)
print("Done!") experiment.log_other("finished", True) experiment.end() ```
You should get an experiment URL initially. You can go to that page and see the experiment update live. The entire script will take 60 seconds to run.
Test Optimizer¶
```python from comet_ml import Optimizer
config = { "algorithm": "bayes", "parameters": { "hidden_layer_size": {"type": "integer", "min": 40, "max": 50}, }, "spec": { "metric": "loss", "objective": "minimize", }, }
optimizer = Optimizer(config)
for experiment in optimizer.get_experiments(project_name="test-comet"): # Pretend loss for testing: loss = experiment.get_parameter("hidden_layer_size") experiment.log_metric("loss", loss) experiment.end() ```
You should log exactly 11 experiments with the second script. The entire script will take a couple of minutes to run.
If you have any issues running either of these scripts, please see your onprem adminstrator.
Additional Resources¶
If you have additional questions, please see the documentation on Comet Configuration Variables or contact us on your Comet Support Slack channel.