artifacts

module wandb.apis.public

W&B Public API for Artifact Management.

This module provides classes for interacting with W&B artifacts and their collections. Classes include:

ArtifactTypes: A paginated collection of artifact types in a project

  • List and query artifact types
  • Access type metadata
  • Create new types

ArtifactCollection: A collection of related artifacts

  • Manage artifact collections
  • Update metadata and descriptions
  • Work with tags and aliases
  • Change collection types

Artifacts: A paginated collection of artifact versions

  • Filter and query artifacts
  • Access artifact metadata
  • Download artifacts

ArtifactFiles: A paginated collection of files within an artifact

  • List and query artifact files
  • Access file metadata
  • Download individual files

function server_supports_artifact_collections_gql_edges

server_supports_artifact_collections_gql_edges(
    client: 'RetryingClient',
    warn: bool = False
)  bool

Check if W&B server supports GraphQL edges for artifact collections.


function artifact_collection_edge_name

artifact_collection_edge_name(server_supports_artifact_collections: bool)  str

Return the GraphQL edge name for artifact collections or sequences.


function artifact_collection_plural_edge_name

artifact_collection_plural_edge_name(
    server_supports_artifact_collections: bool
)  str

Return the GraphQL edge name for artifact collections or sequences.


class ArtifactTypes

An iterable collection of artifact types associated with a project.

Args:

  • client: The client instance to use for querying W&B.
  • entity: The entity (user or team) that owns the project.
  • project: The name of the project to query for artifact types.
  • per_page: The number of artifact types to fetch per page. Default is 50.

method ArtifactTypes.__init__

__init__(
    client: wandb_gql.client.Client,
    entity: str,
    project: str,
    per_page: int = 50
)

property ArtifactTypes.cursor

Returns the cursor position for pagination of file results.


property ArtifactTypes.length

Returns None.


property ArtifactTypes.more

Returns True if there are more artifacts to fetch. Returns False if there are no more files to fetch.


method ArtifactTypes.convert_objects

convert_objects()

Converts GraphQL edges to ArtifactType objects.


method ArtifactTypes.update_variables

update_variables()

Updates the variables dictionary with the cursor.


class ArtifactType

An artifact object that satisfies query based on the specified type.

Args:

  • client: The client instance to use for querying W&B.
  • entity: The entity (user or team) that owns the project.
  • project: The name of the project to query for artifact types.
  • type_name: The name of the artifact type.
  • attrs: Optional mapping of attributes to initialize the artifact type. If not provided, the object will load its attributes from W&B upon initialization.

method ArtifactType.__init__

__init__(
    client: wandb_gql.client.Client,
    entity: str,
    project: str,
    type_name: str,
    attrs: Optional[Mapping[str, Any]] = None
)

property ArtifactType.id

The unique identifier of the artifact type.


property ArtifactType.name

The name of the artifact type.


method ArtifactType.collection

collection(name)

Get a specific artifact collection by name.

Args:

  • name (str): The name of the artifact collection to retrieve.

method ArtifactType.collections

collections(per_page=50)

Get all artifact collections associated with this artifact type.

Args:

  • per_page (int): The number of artifact collections to fetch per page. Default is 50.

method ArtifactType.load

load()

Load the artifact type metadata.


class ArtifactCollections

An iterable collection of artifact collections associated with a project and artifact type.

Args:

  • client: The client instance to use for querying W&B.
  • entity: The entity (user or team) that owns the project.
  • project: The name of the project to query for artifact collections.
  • type_name: The name of the artifact type for which to fetch collections.
  • per_page: The number of artifact collections to fetch per page. Default is 50.

method ArtifactCollections.__init__

__init__(
    client: wandb_gql.client.Client,
    entity: str,
    project: str,
    type_name: str,
    per_page: int = 50
)

property ArtifactCollections.cursor

Returns the cursor position for pagination of file results.


property ArtifactCollections.length

Returns the number of artifact collections.


property ArtifactCollections.more

Returns True if there are more artifact collections to fetch.

Returns False if there are no more files to fetch.


method ArtifactCollections.convert_objects

convert_objects()

Converts GraphQL edges to ArtifactCollection objects.


method ArtifactCollections.update_variables

update_variables()

Updates the variables dictionary with the cursor.


class ArtifactCollection

An artifact collection that represents a group of related artifacts.

Args:

  • client: The client instance to use for querying W&B.
  • entity: The entity (user or team) that owns the project.
  • project: The name of the project to query for artifact collections.
  • name: The name of the artifact collection.
  • type: The type of the artifact collection (e.g., “dataset”, “model”).
  • organization: Optional organization name if applicable.
  • attrs: Optional mapping of attributes to initialize the artifact collection. If not provided, the object will load its attributes from W&B upon initialization.

method ArtifactCollection.__init__

__init__(
    client: wandb_gql.client.Client,
    entity: str,
    project: str,
    name: str,
    type: str,
    organization: Optional[str] = None,
    attrs: Optional[Mapping[str, Any]] = None
)

property ArtifactCollection.aliases

The aliases associated with the artifact collection.


property ArtifactCollection.created_at

The creation timestamp of the artifact collection.


property ArtifactCollection.description

A description of the artifact collection.


property ArtifactCollection.id

The unique identifier of the artifact collection.


property ArtifactCollection.name

The name of the artifact collection.


property ArtifactCollection.tags

The tags associated with the artifact collection.


property ArtifactCollection.type

Returns the type of the artifact collection.


method ArtifactCollection.artifacts

artifacts(per_page=50)

Get all artifact versions associated with this artifact collection.


method ArtifactCollection.change_type

change_type(new_type: str)  None

Deprecated, change type directly with save instead.


method ArtifactCollection.delete

delete()

Delete the entire artifact collection.


method ArtifactCollection.is_sequence

is_sequence()  bool

Return whether the artifact collection is a sequence.


method ArtifactCollection.load

load()

Load the artifact collection metadata.


method ArtifactCollection.save

save()  None

Persist any changes made to the artifact collection.


class Artifacts

An iterable collection of artifact versions associated with a project.

Optionally pass in filters to narrow down the results based on specific criteria.

Args:

  • client: The client instance to use for querying W&B.
  • entity: The entity (user or team) that owns the project.
  • project: The name of the project to query for artifacts.
  • collection_name: The name of the artifact collection to query.
  • type: The type of the artifacts to query. Common examples include “dataset” or “model”.
  • filters: Optional mapping of filters to apply to the query.
  • order: Optional string to specify the order of the results.
  • per_page: The number of artifact versions to fetch per page. Default is 50.
  • tags: Optional string or list of strings to filter artifacts by tags.

method Artifacts.__init__

__init__(
    client: wandb_gql.client.Client,
    entity: str,
    project: str,
    collection_name: str,
    type: str,
    filters: Optional[Mapping[str, Any]] = None,
    order: Optional[str] = None,
    per_page: int = 50,
    tags: Optional[str, List[str]] = None
)

property Artifacts.cursor

Returns the cursor position for pagination of file results.


property Artifacts.length

Returns the number of artifact versions.


property Artifacts.more

Returns True if there are more artifact versions to fetch.


method Artifacts.convert_objects

convert_objects()

Converts GraphQL edges to Artifact objects.


class RunArtifacts

An iterable collection of artifacts associated with a run.

Args:

  • client: The client instance to use for querying W&B.
  • run: The run object to query for artifacts.
  • mode: The mode of artifacts to fetch, either “logged” (output artifacts) or “used” (input artifacts). Default is “logged”.
  • per_page: The number of artifacts to fetch per page. Default is 50.

method RunArtifacts.__init__

__init__(
    client: wandb_gql.client.Client,
    run: 'Run',
    mode='logged',
    per_page: int = 50
)

property RunArtifacts.cursor

Returns the cursor position for pagination of file results.


property RunArtifacts.length

Returns the number of artifacts associated with the run.


property RunArtifacts.more

Returns True if there are more artifacts to fetch.


method RunArtifacts.convert_objects

convert_objects()

Converts GraphQL edges to Artifact objects.


class ArtifactFiles

An iterable collection of files associated with an artifact version.

Args:

  • client: The client instance to use for querying W&B.
  • artifact: The artifact object to query for files.
  • names: Optional sequence of file names to filter the results by. If None, all files will be returned.
  • per_page: The number of files to fetch per page. Default is 50.

method ArtifactFiles.__init__

__init__(
    client: wandb_gql.client.Client,
    artifact: 'wandb.Artifact',
    names: Optional[Sequence[str]] = None,
    per_page: int = 50
)

property ArtifactFiles.cursor

Returns the cursor position for pagination of file results.


property ArtifactFiles.length

Returns the number of files in the artifact.


property ArtifactFiles.more

Returns True if there are more files to fetch. Returns


property ArtifactFiles.path

Returns the path of the artifact.

The path is a list containingthe entity, project name, and artifact name.


method ArtifactFiles.convert_objects

convert_objects()

Converts GraphQL edges to File objects.


method ArtifactFiles.update_variables

update_variables()

Updates the variables dictionary with the cursor and limit.