Skip to main content
Track a model, the model’s dependencies, and other information relevant to that model with the W&B Python SDK. Under the hood, W&B creates a lineage of model artifact that you can view with the W&B App or programmatically with the W&B Python SDK. See the Create model lineage map for more information.

How to log a model

Use the run.log_model API to log a model. Provide the path where your model files are saved to the path parameter. The path can be a local file, directory, or reference URI to an external bucket such as s3://bucket/path. Optionally provide a name for the model artifact for the name parameter. If name is not specified, W&B uses the basename of the input path prepended with the run ID. Copy and paste the proceeding code snippet. Ensure to replace values enclosed in <> with your own.
import wandb

# Initialize a W&B run
run = wandb.init(project="<project>", entity="<entity>")

# Log the model
run.log_model(path="<path-to-model>", name="<name>")
I