wandb
version 0.9.0.bike-dataset
, to help you remember what is inside the artifact. In a later step of your pipeline, you can use this name along with a version like bike-dataset:v1
to download this artifact.log_artifact
are performed asynchronously for performant uploads. This can cause surprising behavior when logging artifacts in a loop. For example:bike-dataset:v0
, the first version of bike-dataset
, and use it in the next script in our pipeline. When you call use_artifact, your script queries W&B to find that named artifact and marks it as input to the run.wandb.Artifact()
class.Artifact()
constructor, or set them directly on an artifact object:artifact.add_file('model.h5')
model.h5
artifact.add_file('checkpoints/model.h5')
model.h5
artifact.add_file('model.h5', name='models/mymodel.h5')
models/mymodel.h5
artifact.add_dir('images')
cat.png
dog.png
artifact.add_dir('images', name='images')
images/cat.png
images/dog.png
artifact.new_file('hello.txt')
hello.txt
http(s)://
: A path to a file accessible over HTTP. The artifact will track checksums in the form of etags and size metadata if the HTTP server supports the ETag
and Content-Length
response headers.s3://
: A path to an object or object prefix in S3. The artifact will track checksums and versioning information (if the bucket has object versioning enabled) for the referenced objects. Object prefixes are expanded to include the objects under the prefix, up to a maximum of 10,000 objects.gs://
: A path to an object or object prefix in GCS. The artifact will track checksums and versioning information (if the bucket has object versioning enabled) for the referenced objects. Object prefixes are expanded to include the objects under the prefix, up to a maximum of 10,000 objects.artifact.add_reference('s3://my-bucket/model.h5')
model.h5
artifact.add_reference('s3://my-bucket/checkpoints/model.h5')
model.h5
artifact.add_reference('s3://my-bucket/model.h5', name='models/mymodel.h5')
models/mymodel.h5
artifact.add_reference('s3://my-bucket/images')
cat.png
dog.png
artifact.add_reference('s3://my-bucket/images', name='images')
images/cat.png
images/dog.png
use_artifact
..download
method.datadir
is a path to a directory containing the artifact’s contents. You can explicitly specify the download destination by setting root
.get_path
method.name
. It returns an Entry
object with the following methods:Entry.download
: Downloads file from the artifact at path name
Entry.ref
: If the entry was stored as a reference using add_reference
, returns the URIuse_artifact
. This will create the artifact in W&B if it doesn’t exist yet. This is idempotent, so you can do it as many times as you like. The artifact will only be created once, as long as the contents of model.h5
remain the same.description
, metadata
, and aliases
of an artifact by just setting them to the desired values and then calling save()
.latest
) of your artifact is useful. W&B makes it easy to clean up these unneeded versions: