Skip to content

Remote and local assets in Artifacts

Comet supports two types of assets within Artifacts: remote and local.

Local assets are data assets that are directly logged to Comet. This means that the data is stored within the Artifact in your Comet Workspace.

Remote assets are references to data assets that are not stored on Comet. For example, URLs to assets stored in S3 buckets or similar data storage systems.

Log a remote Artifact

The following snippet demonstrates how to log remote assets to an Artifact on Comet.

from comet_ml import Artifact, Experiment

experiment = Experiment()
artifact = Artifact("artifact-name", "artifact-type")
artifact.add_remote(
    "s3://bucket/dir/train.csv",
)

experiment.log_artifact(artifact)
experiment.end()

Remote assets do not support previews of the logged asset within the Comet UI. It is also not possible to directly download remote data assets from a Artifact as you would in the case of a local assets.

Instead, you can access the remote asset objects with their links using the artifact.assets property.

For example, fetch a remote asset from an Artifact that tracks the DOTA dataset and take a look at the asset URLs.

experiment = comet_ml.Experiment(
    api_key="<Your API Key>",
    project_name="<Your Project Name>"
)
artifact = experiment.get_artifact('DOTA')
artifact_assets = artifact.assets
print(artifact_assets[0].link)

That code prints out the following URL:

https://cdn.comet.ml/dota_split/images/P0892__1.0__1534___0.png

That is the remote image asset that we are tracking within the Artifact.

Note

There are alternatives to setting the API key programatically. See more here.

Try it Out!

Try out remote Artifacts for yourself in this Colab Notebook!

Open In Colab

Aug. 3, 2022