Model registry
Use W&B Models as a central system of record for your best models, standardized and organized in a model registry across projects and teams.
With W&B Models, you can:
- Bookmark your best model versions for each machine learning task.
- Move model versions through its ML lifecycle; from staging to production.
- Track and audit the history of changes to production models.
How it worksโ
Track and manage your trained models with a few simple steps.
- Log a model version: In your training script, add a few lines of code to save the model files as an artifact to W&B.
- Compare performance: Check live charts to compare the metrics and sample predictions from model training and validation. Identify which model version performed the best.
- Link to registry: Bookmark the best model version by linking it to a registered model, either programmatically in Python or interactively in the W&B UI.
The following code snippet demonstrates how to log and link a model to the Model Registry:
import wandb
import random
# Start a new W&B run
with wandb.init(project="models_quickstart") as run:
# Simulate logging model metrics
run.log({"acc": random.random()})
# Create a simulated model file
with open("my_model.h5", "w") as f:
f.write("Model: " + str(random.random()))
# Save the dummy model to W&B
best_model = wandb.Artifact(f"model_{run.id}", type="model")
best_model.add_file("my_model.h5")
run.log_artifact(best_model)
# Link the model to the Model Registry
run.link_artifact(best_model, "model-registry/My Registered Model")
run.finish()
- Test and deploy your model: Transition model versions through customizable workflows stages, such as
staging
andproduction
.
How to get startedโ
Depending on your use case, explore the following resources to get started with W&B Models:
- Check out the Model Registry Quickstart YouTube video.
- Read the models walkthrough for a step-by-step outline of the W&B Python SDK commands you could use to create, track, and use a dataset artifact.
- Review this report on how the Model Registry fits into your ML workflow and the benefits of using one for model management.
- Explore this chapter to learn how about:
- Role based access controls (RBAC).
- How to automate model testing and deployment.
- Use tags to organize registered models.
- Set up Slack notifications when a new model version is linked to a model registry.