When to use an alias versus using a tagUse an alias to reference a specific artifact version. Each alias within a collection is unique. Only one artifact version can have a specific alias at a time.Use tags to organize and group artifact versions or collections based on a common theme. Multiple artifact versions and collections can share the same tag.
Default aliases
W&B automatically assigns the following aliases to each artifact version you link with the same name:- The
latest
alias to the most recent artifact version you link to a collection. - A unique version number. W&B counts each artifact version (zero indexing) you link. W&B uses the count number to assign a unique version number to that artifact.
zoo_model
three times, W&B creates three aliases v0
, v1
, and v2
respectively. v2
also has the latest
alias.
Custom aliases
Create one or more custom aliases for a specific artifact versions based on your unique use case. For example:- You might use aliases such as
dataset_version_v0
,dataset_version_v1
, anddataset_version_v2
to identify which dataset a model was trained on. - You might use a
best_model
alias to keep track of the best performing artifact model version.
Protected aliases provide a way to label and identify which artifact versions to protect from modification or deletion.
- W&B Registry
- Python SDK
- Navigate to the W&B Registry.
- Click the View details button in a collection.
- Within the Versions section, click the View button for a specific artifact version.
- Click the + button to add one or more aliases next to the Aliases field.
Protected aliases
Use a protected alias to both label and identify artifact versions that should not be modified or deleted. For example, consider using aproduction
protected alias to label and identify artifact versions that are in used in your organization’s machine learning production pipeline.
Registry admin users and service accounts with the Admin role can create protected aliases and add or remove protected aliases from an artifact version. Users and service accounts with Member, Viewer, and Restricted Viewer roles cannot unlink a protected version or delete a collection that contains a protected alias. See Configure registry access for details.
Common protected aliases include:
- Production: The artifact version is ready for production use.
- Staging: The artifact version is ready for testing.
Create a protected alias
The following steps describe how to create a protected alias in the W&B Registry UI:- Navigate to the Registry App.
- Select a registry.
- Click the gear button on the top right of the page to view the registry’s settings.
- Within the Protected Aliases section, click the + button to add one or more protected aliases.
Unlike custom aliases that are not protected, creating protected aliases is available exclusively in the W&B Registry UI and not programmatically with the Python SDK. To add a protected alias to an artifact version, you can use the W&B Registry UI or the Python SDK.
- Navigate to the W&B Registry.
- Click the View details button in a collection.
- Within the Versions section, select the View button for a specific artifact version.
- Click the + button to add one or more protected aliases next to the Aliases field.
Find existing aliases
You can find existing aliases with the global search bar in the W&B Registry. To find a protected alias:- Navigate to the W&B Registry App.
- Specify the search term in the search bar at the top of the page. Press Enter to search.
Example
The following code example is a continuation of the W&B Registry Tutorial. To use the following code, you must first retrieve and process the Zoo dataset as described in the notebook. Once you have the Zoo dataset, you can create an artifact version and add custom aliases to it.
Model
collection in the Zoo_Classifier_Models
registry.
- First, you create an artifact object (
wandb.Artifact()
). - Next, you add two dataset PyTorch tensors to the artifact object with
wandb.Artifact.add_file()
. - Lastly, you link the artifact version to the
Model
collection in theZoo_Classifier_Models
registry withlink_artifact()
. You also add two custom aliases to the artifact version by passingproduction-us
andproduction-eu
as arguments to thealiases
parameter.