Skip to main content
The DeepChem library provides open source tools that democratize the use of deep-learning in drug discovery, materials science, chemistry, and biology. This W&B integration adds simple and easy-to-use experiment tracking and model checkpointing while training models using DeepChem.

DeepChem logging in 3 lines of code

logger = WandbLogger(…)
model = TorchModel(…, wandb_logger=logger)
model.fit(…)
DeepChem molecular analysis

Report and Google Colab

Explore the Using W&B with DeepChem: Molecular Graph Convolutional Networks article for an example charts generated using the W&B DeepChem integration. To dive straight into working code, check out this Google Colab.

Track experiments

Set up W&B for DeepChem models of type KerasModel or TorchModel.

Sign up and create an API key

An API key authenticates your machine to W&B. You can generate an API key from your user profile.
For a more streamlined approach, you can generate an API key by going directly to the W&B authorization page. Copy the displayed API key and save it in a secure location such as a password manager.
  1. Click your user profile icon in the upper right corner.
  2. Select User Settings, then scroll to the API Keys section.
  3. Click Reveal. Copy the displayed API key. To hide the API key, reload the page.

Install the wandb library and log in

To install the wandb library locally and log in:
  • Command Line
  • Python
  • Python notebook
  1. Set the WANDB_API_KEY environment variable to your API key.
    export WANDB_API_KEY=<your_api_key>
    
  2. Install the wandb library and log in.
    pip install wandb
    
    wandb login
    

Log your training and evaluation data to W&B

Training loss and evaluation metrics can be automatically logged to W&B. Optional evaluation can be enabled using the DeepChem ValidationCallback, the WandbLogger will detect ValidationCallback callback and log the metrics generated.
  • TorchModel
  • KerasModel
from deepchem.models import TorchModel, ValidationCallback

vc = ValidationCallback(…)  # optional
model = TorchModel(…, wandb_logger=logger)
model.fit(…, callbacks=[vc])
logger.finish()
I