wandb.apis.public.Artifact
Last updated
Last updated
A wandb Artifact.
An artifact that has been logged, including all its attributes, links to the runs that use it, and a link to the run that logged it.
Basic usage
Updating an artifact
Artifact graph traversal
Deleting an artifact
Attributes | |
| The aliases associated with this artifact. |
| Returns: (str): The artifact's commit hash which is used in http URLs |
| Returns: (datetime): The time at which the artifact was created. |
| Returns: (str): Free text that offers a description of the artifact. The description is markdown rendered in the UI, so this is a good place to put links, etc. |
| Returns: (str): The artifact's logical digest, a checksum of its contents. If an artifact has the same digest as the current |
| Returns: (str): The name of the entity this artifact belongs to. |
| Returns: (str): The artifact's ID |
| Returns: (ArtifactManifest): The artifact's manifest, listing all of its contents. You cannot add more files to an artifact once you've retrieved its manifest. |
| Returns: (dict): Structured data associated with the artifact, for example class distribution of a dataset. This will eventually be queryable and plottable in the UI. There is a hard limit of 100 total keys. |
| Returns: (str): The artifact's name |
| Returns: (str): The name of the project this artifact belongs to. |
| Returns: (int): The size in bytes of the artifact. Includes any references tracked by this artifact. |
| Returns: (str): The state of the artifact, which can be one of "PENDING", "COMMITTED", or "DELETED". |
| Returns: (str): The artifact's type |
| Returns: (datetime): The time at which the artifact was last updated. |
| Returns: (int): The version of this artifact. For example, if this is the first version of an artifact, its |
add
Adds wandb.WBValue obj
to the artifact.
Arguments | |
| (wandb.WBValue) The object to add. Currently support one of Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask, BoundingBoxes2D, Audio, Image, Video, Html, Object3D |
| (str) The path within the artifact to add the object. |
Returns | |
| the added manifest entry |
Basic usage
Retrieving an object:
add_dir
Adds a local directory to the artifact.
Arguments | |
| (str) The path to the directory being added. |
| (str, optional) The path within the artifact to use for the directory being added. Defaults to files being added under the root of the artifact. |
Adding a directory without an explicit name:
Adding a directory without an explicit name:
Raises | |
| if problem. |
Returns | |
None |
add_file
Adds a local file to the artifact.
Arguments | |
| (str) The path to the file being added. |
| (str, optional) The path within the artifact to use for the file being added. Defaults to the basename of the file. |
| (bool, optional) If true, then the file is renamed deterministically to avoid collisions. (default: False) |
Adding a file without an explicit name:
Adding a file with an explicit name:
Raises | |
| if problem |
Returns | |
| the added manifest entry |
add_reference
Adds a reference denoted by a URI to the artifact. Unlike adding files or directories, references are NOT uploaded to W&B. However, artifact methods such as download()
can be used regardless of whether the artifact contains references or uploaded files.
By default, W&B offers special handling for the following schemes:
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 will be pulled from the object metadata. If bucket versioning
is enabled, then the version ID is also tracked.
gs: The checksum and size will be pulled from the object metadata. If bucket versioning
is enabled, then the version ID is also tracked.
file: The checksum and size will be 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.
Arguments | |
| (str) The URI path of the reference to add. Can be an object returned from Artifact.get_path to store a reference to another artifact's entry. |
| (str) The path within the artifact to place the contents of this reference |
| (bool, optional) Whether or not to checksum the resource(s) located at the reference URI. Checksumming is strongly recommended as it enables automatic integrity validation, however it can be disabled to speed up artifact creation. (default: True) |
| (int, optional) The maximum number of objects to consider when adding a reference that points to directory or bucket store prefix. For S3 and GCS, this limit is 10,000 by default but is uncapped for other URI schemes. (default: None) |
Raises | |
| If problem. |
Returns | |
List[ArtifactManifestEntry]: The added manifest entries. |
Adding an HTTP link:
Adding an S3 prefix without an explicit name:
Adding a GCS prefix with an explicit name:
checkout
Replaces the specified root directory with the contents of the artifact.
WARNING: This will DELETE all files in root
that are not included in the artifact.
Arguments | |
| (str, optional) The directory to replace with this artifact's files. |
Returns | |
(str): The path to the checked out contents. |
delete
Delete artifact and its files.
download
Downloads the contents of the artifact to the specified root directory.
NOTE: Any existing files at root
are left untouched. Explicitly delete root before calling download
if you want the contents of root
to exactly match the artifact.
Arguments | |
| (str, optional) The directory in which to download this artifact's files. |
| (bool, optional) If true, then all dependent artifacts are eagerly downloaded. Otherwise, the dependent artifacts are downloaded as needed. |
Returns | |
(str): The path to the downloaded contents. |
expected_type
Returns the expected type for a given artifact name and project
file
Download a single file artifact to dir specified by the
Arguments | |
| (str, optional) The root directory in which to place the file. Defaults to './artifacts//'. |
Returns | |
(str): The full path of the downloaded file. |
from_id
get
Gets the WBValue object located at the artifact relative name
.
NOTE: This will raise an error unless the artifact has been fetched using use_artifact
, fetched using the API, or wait()
has been called.
Arguments | |
| (str) The artifact relative name to get |
Raises | |
| if problem |
Basic usage
get_path
Gets the path to the file located at the artifact relative name
.
NOTE: This will raise an error unless the artifact has been fetched using use_artifact
, fetched using the API, or wait()
has been called.
Arguments | |
| (str) The artifact relative name to get |
Raises | |
| if problem |
Basic usage
logged_by
Retrieves the run which logged this artifact
Returns | |
| Run object which logged this artifact |
new_file
Open a new temporary file that will be automatically added to the artifact.
Arguments | |
| (str) The name of the new file being added to the artifact. |
| (str, optional) The mode in which to open the new file. |
Returns | |
(file): A new file object that can be written to. Upon closing, the file will be automatically added to the artifact. |
save
Persists artifact changes to the wandb backend.
used_by
Retrieves the runs which use this artifact directly
Returns | |
[Run]: a list of Run objects which use this artifact |
verify
Verify that the actual contents of an artifact at a specified directory root
match the expected contents of the artifact according to its manifest.
All files in the directory are checksummed and the checksums are then cross-referenced against the artifact's manifest.
NOTE: References are not verified.
Arguments | |
| (str, optional) The directory to verify. If None artifact will be downloaded to './artifacts//' |
Raises | |
(ValueError): If the verification fails. |
wait
Waits for this artifact to finish logging, if needed.
Returns | |
Artifact |
__getitem__
Gets the WBValue object located at the artifact relative name
.
NOTE: This will raise an error unless the artifact has been fetched using use_artifact
, fetched using the API, or wait()
has been called.
Arguments | |
| (str) The artifact relative name to get |
Raises | |
| if problem |
Basic usage
Retrieving an object:
Class Variables | |
QUERY |