Skip to main content
Use the W&B Python SDK to download a model artifact that you linked to the Model Registry.
You are responsible for providing additional Python functions, API calls to reconstruct, deserialize your model into a form that you can work with.W&B suggests that you document information on how to load models into memory with model cards. For more information, see the Document machine learning models page.
Replace values within <> with your own:
import wandb

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

# Access and download model. Returns path to downloaded artifact
downloaded_model_path = run.use_model(name="<your-model-name>")
Reference a model version with one of following formats listed:
  • latest - Use latest alias to specify the model version that is most recently linked.
  • v# - Use v0, v1, v2, and so on to fetch a specific version in the Registered Model
  • alias - Specify the custom alias that you and your team assigned to your model version
See use_model in the API Reference guide for more information on possible parameters and return type.
Planned deprecation for W&B Model Registry in 2024The proceeding tabs demonstrate how to consume model artifacts using the soon to be deprecated Model Registry.Use the W&B Registry to track, organize and consume model artifacts. For more information see the Registry docs.
  • CLI
  • W&B App
Replace values within <> with your own:
import wandb
# Initialize a run
run = wandb.init(project="<project>", entity="<entity>")
# Access and download model. Returns path to downloaded artifact
downloaded_model_path = run.use_model(name="<your-model-name>")
Reference a model version with one of following formats listed:
  • latest - Use latest alias to specify the model version that is most recently linked.
  • v# - Use v0, v1, v2, and so on to fetch a specific version in the Registered Model
  • alias - Specify the custom alias that you and your team assigned to your model version
See use_model in the API Reference guide for parameters and return type.
I