Setup Logging

Setup Logging#

ChemTorch uses Weights & Biases (W&B) for logging, visualization, and run management. This guide will show you how to quickly setup W&B for ChemTorch.

Connect W&B#

If you are new to W&B, you will need to create an account and authorize your machine:

  1. First, create a free account at https://wandb.ai/signup (if you don’t have one yet).

  2. Then, go to https://wandb.ai/authorize, copy your API key, and set the WANDB_API_KEY environment variable (if you haven’t done so already):

    export WANDB_API_KEY="your_api_key_here"
    
  3. Login to W&B from the command line:

    wandb login
    

Whenever you use another machine or a new environment (e.g. GPU cluster), you will need to repeat step 2 and 3.

Log Your ChemTorch Runs#

Once you are connected to W&B, you can log your ChemTorch runs by appending log=true when launching an experiment. For example, using the quick start command from the Quick Start guide:

chemtorch +experiment=graph data_module.subsample=0.05 log=true

Now, you run will be logged to your W&B account. Open the W&B web interface and navigate to Projects → chemtorch to see your run in the project workspace. By default, the run will be logged to the project chemtorch under your username. You can change the project name via the project_name option:

chemtorch +experiment=graph data_module.subsample=0.05 log=true project_name=my_project

To avoid having to specify project_name every time, you can override the default project name in conf/base.yaml to your desired project name:

# conf/base.yaml
project_name: my_project

By default, the runs will have arbitrary names. You can name your runs by setting run_name:

chemtorch +experiment=graph data_module.subsample=0.05 log=true run_name=my_first_run

You can also group related runs together by setting group_name:

chemtorch +experiment=graph data_module.subsample=0.05 log=true group_name=my_experiment