Artifacts Reference

Generated docs from the wandb Python library

wandb.sdk.wandb_artifacts

[view_source]

Artifact Objects

class Artifact(object)

[view_source]

An artifact object you can write files into, and pass to log_artifact.

add_reference

| add_reference(uri, name=None, checksum=True, max_objects=None)

[view_source]

adds uri to the artifact via a reference, located at name. You can use Artifact#get_path(name) to retrieve this object.

Arguments:

  • uri: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.

  • name:str - the path to save

add

| add(obj, name)

[view_source]

Adds obj to the artifact, located at name. You can use Artifact#get(name) after downloading the artifact to retrieve this object.

Arguments:

  • obj wandb.WBValue - The object to save in an artifact

  • name str - The path to save

get_added_local_path_name

| get_added_local_path_name(local_path)

[view_source]

If local_path was already added to artifact, return its internal name.

ArtifactManifestV1 Objects

class ArtifactManifestV1(ArtifactManifest)

[view_source]

to_manifest_json

| to_manifest_json()

[view_source]

This is the JSON that's stored in wandb_manifest.json

If include_local is True we also include the local paths to files. This is used to represent an artifact that's waiting to be saved on the current system. We don't need to include the local paths in the artifact manifest contents.

TrackingHandler Objects

class TrackingHandler(StorageHandler)

[view_source]

__init__

| __init__(scheme=None)

[view_source]

Tracks paths as is, with no modification or special processing. Useful when paths being tracked are on file systems mounted at a standardized location.

For example, if the data to track is located on an NFS share mounted on /data, then it is sufficient to just track the paths.

LocalFileHandler Objects

class LocalFileHandler(StorageHandler)

[view_source]

Handles file:// references

__init__

| __init__(scheme=None)

[view_source]

Tracks files or directories on a local filesystem. Directories are expanded to create an entry for each file contained within.

WBArtifactHandler Objects

class WBArtifactHandler(StorageHandler)

[view_source]

Handles loading and storing Artifact reference-type files

scheme

| @property
| scheme()

[view_source]

overrides parent scheme

Returns:

The scheme to which this handler applies. :rtype: str

load_path

| load_path(artifact, manifest_entry, local=False)

[view_source]

Loads the file within the specified artifact given its corresponding entry. In this case, the referenced artifact is downloaded and a new symlink is created and returned to the caller.

Arguments:

  • manifest_entry: The index entry to load

    :type manifest_entry: ArtifactManifestEntry

Returns:

A path to the file represented by index_entry :rtype: os.PathLike

store_path

| store_path(artifact, path, name=None, checksum=True, max_objects=None)

[view_source]

Stores the file or directory at the given path within the specified artifact. In this case we recursively resolve the reference until the result is a concrete asset so that we don't have multiple hops. TODO: This resolution could be done in the server for performance improvements.

Arguments:

  • artifact: The artifact doing the storing

  • path: The path to store

    :type path: str

  • name: If specified, the logical name that should map to path

    :type name: str

Returns:

A list of manifest entries to store within the artifact :rtype: list(ArtifactManifestEntry)