Construct an empty W&B Artifact. Populate an artifacts contents with methods that
begin with add. Once the artifact has all the desired files, you can call
wandb.log_artifact() to log it.
Args
name
A human-readable name for the artifact. Use the name to identify a specific artifact in the W&B App UI or programmatically. You can interactively reference an artifact with the use_artifact Public API. A name can contain letters, numbers, underscores, hyphens, and dots. The name must be unique across a project.
type
The artifact's type. Use the type of an artifact to both organize and differentiate artifacts. You can use any string that contains letters, numbers, underscores, hyphens, and dots. Common types include dataset or model. Include model within your type string if you want to link the artifact to the W&B Model Registry.
description
A description of the artifact. For Model or Dataset Artifacts, add documentation for your standardized team model or dataset card. View an artifact's description programmatically with the Artifact.description attribute or programmatically with the W&B App UI. W&B renders the description as markdown in the W&B App.
metadata
Additional information about an artifact. Specify metadata as a dictionary of key-value pairs. You can specify no more than 100 total keys.
Returns
An Artifact object.
Attributes
aliases
List of one or more semantically-friendly references or identifying "nicknames" assigned to an artifact version. Aliases are mutable references that you can programmatically reference. Change an artifact's alias with the W&B App UI or programmatically. See Create new artifact versions for more information.
collection
The collection this artifact was retrieved from. A collection is an ordered group of artifact versions. If this artifact was retrieved from a portfolio / linked collection, that collection will be returned rather than the collection that an artifact version originated from. The collection that an artifact originates from is known as the source sequence.
commit_hash
The hash returned when this artifact was committed.
created_at
Timestamp when the artifact was created.
description
A description of the artifact.
digest
The logical digest of the artifact. The digest is the checksum of the artifact's contents. If an artifact has the same digest as the current latest version, then log_artifact is a no-op.
entity
The name of the entity of the secondary (portfolio) artifact collection.
file_count
The number of files (including references).
id
The artifact's ID.
manifest
The artifact's manifest. The manifest lists all of its contents, and can't be changed once the artifact has been logged.
metadata
User-defined artifact metadata. Structured data associated with the artifact.
name
The artifact name and version in its secondary (portfolio) collection. A string with the format {collection}:{alias}. Before the artifact is saved, contains only the name since the version is not yet known.
project
The name of the project of the secondary (portfolio) artifact collection.
qualified_name
The entity/project/name of the secondary (portfolio) collection.
size
The total size of the artifact in bytes. Includes any references tracked by this artifact.
source_collection
The artifact's primary (sequence) collection.
source_entity
The name of the entity of the primary (sequence) artifact collection.
source_name
The artifact name and version in its primary (sequence) collection. A string with the format {collection}:{alias}. Before the artifact is saved, contains only the name since the version is not yet known.
source_project
The name of the project of the primary (sequence) artifact collection.
source_qualified_name
The entity/project/name of the primary (sequence) collection.
source_version
The artifact's version in its primary (sequence) collection. A string with the format v{number}.
state
The status of the artifact. One of: "PENDING", "COMMITTED", or "DELETED".
tags
List of one or more tags assigned to this artifact version.
ttl
The time-to-live (TTL) policy of an artifact. Artifacts are deleted shortly after a TTL policy's duration passes. If set to None, the artifact deactivates TTL policies and will be not scheduled for deletion, even if there is a team default TTL. An artifact inherits a TTL policy from the team default if the team administrator defines a default TTL and there is no custom policy set on an artifact.
type
The artifact's type. Common types include dataset or model.
updated_at
The time when the artifact was last updated.
version
The artifact's version in its secondary (portfolio) collection.
The object to add. Currently support one of Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask, BoundingBoxes2D, Audio, Image, Video, Html, Object3D
name
The path within the artifact to add the object.
overwrite
If True, overwrite existing objects with the same file path (if applicable).
Returns
The added manifest entry
Raises
ArtifactFinalizedError
You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead.
The subdirectory name within an artifact. The name you specify appears in the W&B App UI nested by artifact's type. Defaults to the root of the artifact.
skip_cache
If set to True, W&B will not copy/move files to the cache while uploading
policy
"mutable"
Raises
ArtifactFinalizedError
You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead.
The path within the artifact to use for the file being added. Defaults to the basename of the file.
is_tmp
If true, then the file is renamed deterministically to avoid collisions.
skip_cache
If True, W&B will not copy files to the cache after uploading.
policy
By default, set to "mutable". If set to "mutable", create a temporary copy of the file to prevent corruption during upload. If set to "immutable", disable protection and rely on the user not to delete or change the file.
overwrite
If True, overwrite the file if it already exists.
Returns
The added manifest entry.
Raises
ArtifactFinalizedError
You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead.
Unlike files or directories that you add to an artifact, references are not
uploaded to W&B. For more information,
see Track external files.
By default, the following schemes are supported:
http(s): The size and digest of the file will be inferred by the
Content-Length and the ETag response headers returned by the server.
s3: The checksum and size are pulled from the object metadata. If bucket
versioning is enabled, then the version ID is also tracked.
gs: The checksum and size are pulled from the object metadata. If bucket
versioning is enabled, then the version ID is also tracked.
https, domain matching *.blob.core.windows.net (Azure): The checksum and size
are be pulled from the blob metadata. If storage account versioning is
enabled, then the version ID is also tracked.
file: The checksum and size are pulled from the file system. This scheme
is useful if you have an NFS share or other externally mounted volume
containing files you wish to track but not necessarily upload.
For any other scheme, the digest is just a hash of the URI and the size is left
blank.
Args
uri
The URI path of the reference to add. The URI path can be an object returned from Artifact.get_entry to store a reference to another artifact's entry.
name
The path within the artifact to place the contents of this reference.
checksum
Whether or not to checksum the resource(s) located at the reference URI. Checksumming is strongly recommended as it enables automatic integrity validation. Disabling checksumming will speed up artifact creation but reference directories will not iterated through so the objects in the directory will not be saved to the artifact. We recommend setting checksum=False when adding reference objects, in which case a new version will only be created if the reference URI changes.
max_objects
The maximum number of objects to consider when adding a reference that points to directory or bucket store prefix. By default, the maximum number of objects allowed for Amazon S3, GCS, Azure, and local files is 10,000,000. Other URI schemas do not have a maximum.
Returns
The added manifest entries.
Raises
ArtifactFinalizedError
You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead.
If called on a linked artifact (i.e. a member of a portfolio collection): only the link is deleted, and the
source artifact is unaffected.
Args
delete_aliases
If set to True, deletes all aliases associated with the artifact. Otherwise, this raises an exception if the artifact has existing aliases. This parameter is ignored if the artifact is linked (i.e. a member of a portfolio collection).
Download the contents of the artifact to the specified root directory.
Existing files located within root are not modified. Explicitly delete root
before you call download if you want the contents of root to exactly match
the artifact.
Args
root
The directory W&B stores the artifact's files.
allow_missing_references
If set to True, any invalid reference paths will be ignored while downloading referenced files.
skip_cache
If set to True, the artifact cache will be skipped when downloading and W&B will download each file into the default root or specified download directory.
path_prefix
If specified, only files with a path that starts with the given prefix will be downloaded. Uses unix format (forward slashes).
Returns
The path to the downloaded contents.
Raises
ArtifactNotLoggedError
If the artifact is not logged.
RuntimeError
If the artifact is attempted to be downloaded in offline mode.
You cannot modify an artifact version once it is finalized because the artifact
is logged as a specific artifact version. Create a new artifact version
to log more data to an artifact. An artifact is automatically finalized
when you log the artifact with log_artifact.
Link this artifact to a portfolio (a promoted collection of artifacts).
Args
target_path
The path to the portfolio inside a project. The target path must adhere to one of the following schemas {portfolio}, {project}/{portfolio} or {entity}/{project}/{portfolio}. To link the artifact to the Model Registry, rather than to a generic portfolio inside a project, set target_path to the following schema {"model-registry"}/{Registered Model Name} or {entity}/{"model-registry"}/{Registered Model Name}.
aliases
A list of strings that uniquely identifies the artifact inside the specified portfolio.
The item to remove. Can be a specific manifest entry or the name of an artifact-relative path. If the item matches a directory all items in that directory will be removed.
Raises
ArtifactFinalizedError
You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead.