Link an artifact version to a registry
Programmatically or interactively link artifact versions to a registry.
When you link an artifact to a registry, this "publishes" that artifact to that registry. Any user that has access to that registry can access linked artifact versions when you link an artifact to a collection.
In other words, linking an artifact to a registry collection brings that artifact version from a private, project-level scope, to the shared organization level scope.
Based on your use case, follow the instructions described in the tabs below to link an artifact version.
- Python SDK
- Registry App
- Artifact browser
Use the link_artifact
method to programmatically link an artifact to a registry. When you link an artifact, specify the path where you want artifact version to link to for the target_path
parameter. The target path takes the form of "{ORG_ENTITY_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}"
.
Replace values enclosed in <>
with your own:
import wandb
ARTIFACT_NAME = "<ARTIFACT-TO-LINK>"
ARTIFACT_TYPE = "ARTIFACT-TYPE"
ENTITY_NAME = "<TEAM-ARTIFACT-BELONGS-IN>"
PROJECT_NAME = "<PROJECT-ARTIFACT-TO-LINK-BELONGS-IN>"
ORG_ENTITY_NAME = "<YOUR ORG NAME>"
REGISTRY_NAME = "<REGISTRY-TO-LINK-TO>"
COLLECTION_NAME = "<REGISTRY-COLLECTION-TO-LINK-TO>"
run = wandb.init(entity=ENTITY_NAME, project=PROJECT_NAME)
artifact = wandb.Artifact(name=ARTIFACT_NAME, type=ARTIFACT_TYPE)
run.link_artifact(
artifact=artifact,
target_path=f"{ORG_ENTITY_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}"
)
run.finish()
If you want to link an artifact version to the Models registry or the Dataset registry, set the artifact type to "model"
or "dataset"
, respectively.
- Navigate to the Registry App.
- Hover your mouse next to the name of the collection you want to link an artifact version to.
- Select the meatball menu icon (three horizontal dots) next to View details.
- From the dropdown, select Link new version.
- From the sidebar that appears, select the name of a team from the Team dropdown.
- From the Project dropdown, select the name of the project that contains your artifact.
- From the Artifact dropdown, select the name of the artifact.
- From the Version dropdown, select the artifact version you want to link to the collection.
- Navigate to your project's artifact browser on the W&B App at:
https://wandb.ai/<entity>/<project>/artifacts
- Select the Artifacts icon on the left sidebar.
- Click on the artifact version you want to link to your registry.
- Within the Version overview section, click the Link to registry button.
- From the modal that appears on the right of the screen, select an artifact from the Select a register model menu dropdown.
- Click Next step.
- (Optional) Select an alias from the Aliases dropdown.
- Click Link to registry.
- Source version: the artifact version inside a team's project that is logged to a run.
- Linked version: the artifact version that is published to the registry. This is a pointer to the source artifact, and is the exact same artifact version, just made available in the scope of the registry.