Skip to main content
This page describes how to publish an artifact version to a registry collection so that other teams in your organization can discover and use it. To make an artifact version available to your organization, link it to a collection in the W&B Registry. Linking moves the version from a private, project-level scope to a shared, organization-level scope. You can link an artifact version programmatically with the W&B Python SDK or interactively in the W&B UI. When you link an artifact, W&B creates a reference between the source artifact and the collection entry. The linked version points to the source artifact version that was logged to a run within a project. You can view both the linked version in the collection and the source version in the project where it was logged. Choose a workflow based on whether you want to create the artifact during a run, create it without a run, or link an existing artifact version.
Before you start, check the following:
  • The types of artifacts that the collection permits. For more information about collection types, see “Collection types” within Create a collection.
  • The registry that the collection belongs to already exists. To check that the registry exists, navigate to the Registry App and search for the name of the registry.
Programmatically link an artifact version to a collection with wandb.Run.link_artifact() or wandb.Artifact.link().The following table summarizes the methods you can use to link an artifact version to a collection and what W&B records when you use each method.Pass the destination collection path to the target_path parameter. The path consists of the wandb-registry- prefix, the registry name, and the collection name:
Link an artifact from a run
Use wandb.Run.link_artifact() to create and link an artifact version during an active run. W&B logs draft artifacts as outputs of the run before linking them.To create and link an artifact version:
  1. Initialize a run with wandb.init().
  2. Create an Artifact object and add one or more files.
  3. Call wandb.Run.link_artifact() and specify the destination collection.
Replace the bracketed placeholders with your own values:
Create and link an artifact
Use wandb.Artifact.link() to create and link a draft artifact without explicitly initializing a run. W&B creates an automatic run if needed to save the artifact before linking it.To create and link an artifact version:
  1. Create an Artifact object and add one or more files.
  2. Call wandb.Artifact.link() and specify the destination collection.
Replace the bracketed placeholders with your own:
Link an existing artifact
Use wandb.Artifact.link() on an artifact fetched with wandb.Api().artifact() to link an existing committed artifact version without creating a new run.
  1. Create a Public API client with wandb.Api().
  2. Retrieve the artifact version with wandb.Api.artifact().
  3. Call wandb.Artifact.link() and specify the destination collection.
You can view a linked artifact’s metadata, version data, usage, lineage information and more in the Registry App.

View linked artifacts in a registry

After you link an artifact version, it becomes available to your organization through the registry. View information about linked artifacts such as metadata, lineage, and usage information in the W&B Registry.
  1. Navigate to the W&B Registry.
  2. Select the name of the registry that you linked the artifact to.
  3. Select the name of the collection.
  4. If the collection’s artifacts log metrics, compare metrics across versions by clicking Show metrics.
  5. From the list of artifact versions, select the version you want to access. W&B assigns version numbers incrementally to each linked artifact version, starting with v0.
  6. To view details about an artifact version, click the version. From the tabs on this page, you can view that version’s metadata (including logged metrics), lineage, and usage information.
Record the Full Name field within the Version tab. The full name of a linked artifact consists of the registry, collection name, and the alias or index of the artifact version.
Full name of a linked artifact
You need the full name of a linked artifact to access the artifact version programmatically.

Troubleshooting

If you can’t link an artifact, check the following common issues:

Artifacts logged from a personal account

You can’t link artifacts logged to W&B with a personal entity to the registry. Make sure that you log artifacts with a team entity within your organization. Only artifacts logged within an organization’s team can be linked to the organization’s registry.
Ensure that you log an artifact with a team entity if you want to link that artifact to a registry.

Find your team entity

W&B uses the name of your team as the team’s entity. For example, if your team is called team-awesome, your team entity is team-awesome. To confirm the name of your team, follow these steps:
  1. Navigate to your team’s W&B profile page.
  2. Copy the site’s URL. It has the form https://wandb.ai/[TEAM], where [TEAM] is both the name of your team and the team’s entity.

Log from a team entity

  1. Specify the team as the entity when you initialize a run with wandb.init(). If you don’t specify the entity when you initialize a run, the run uses your default entity, which may or may not be your team entity.
  2. Log the artifact to the run either with wandb.Run.log_artifact() or by creating an Artifact object and then adding files to it with:
    To log artifacts, see Construct artifacts.
  3. If you logged an artifact to your personal entity, you need to re-log it to an entity within your organization.

Confirm the path of a registry in the W&B UI

Create an empty collection to confirm the path of the registry in the W&B UI. To do so, follow the steps below:
  1. Navigate to the W&B Registry at https://wandb.ai/registry/.
  2. Click the registry you want to link an artifact to.
  3. Click the empty collection. If an empty collection doesn’t exist, create a new collection.
  4. Within the code snippet that appears, identify the target_path field within .link_artifact().
  5. Optional: Delete the collection.
Create an empty collection
For example, after you complete the previous steps, you find the code block with the target_path parameter:
Break this down into its components to see what you need to use to create the path to link your artifact programmatically:
Ensure that you replace the name of the collection from the temporary collection with the name of the collection that you want to link your artifact to.