Artifact

Artifact

Artifact.assets

The list of ArtifactAssets that have been logged with this Artifact.

Artifact.download_local_path

If the Artifact object was returned by LoggedArtifact.download, returns the root path where the assets has been downloaded. Else, returns None.


Artifact.__init__

__init__(self, name, artifact_type, version=None, aliases=None, metadata=None,
    version_tags=None)

Comet Artifacts allow keeping track of assets beyond any particular experiment. You can keep track of Artifact versions, create many types of assets, manage them, and use them in any step in your ML pipelines---from training to production deployment.

Artifacts live in a Comet Project, are identified by their name and version string number.

Example how to log an artifact with an asset:

from comet_ml import Artifact, Experiment

experiment = Experiment()
artifact = Artifact("Artifact-Name", "Artifact-Type")
artifact.add("local-file")

experiment.log_artifact(artifact)
experiment.end()

Example how to get and download an artifact assets:

from comet_ml import Experiment

experiment = Experiment()
artifact = experiment.get_artifact("Artifact-Name", WORKSPACE, PROJECT_NAME)

artifact.download("/data/input")

The artifact is created on the frontend only when calling Experiment.log_artifact

Args:

  • name: The artifact name.
  • artifact_type: The artifact-type, for example dataset.
  • version: Optional. The version number to create. If not provided, a new version number will be created automatically.
  • aliases: Optional. Iterable of String. Some aliases to attach to the future Artifact Version. The aliases list is converted into a set for de-duplication.
  • metadata: Optional. Some additional data to attach to the future Artifact Version. Must be a JSON-encodable dict.

Artifact.add

add(self, local_path_or_data, logical_path=None, overwrite=False,
    copy_to_tmp=True, metadata=None)

Add a local asset to the current pending artifact object.

Args:

  • local_path_or_data: String or File-like - either the file path of the file you want to log, or a file-like asset.
  • logical_path: String - Optional. A custom file name to be displayed. If not provided the filename from the local_path_or_data argument will be used.
  • overwrite: if True will overwrite all existing assets with the same name.
  • copy_to_tmp: If local_path_or_data is a file-like object, then this flag determines if the file is first copied to a temporary file before upload. If copy_to_tmp is False, then it is sent directly to the cloud.
  • metadata: Optional. Some additional data to attach to the the audio asset. Must be a JSON-encodable dict.

Artifact.add_remote

add_remote(self, uri, logical_path=None, overwrite=False, asset_type="asset",
    metadata=None)

Add a remote asset to the current pending artifact object. A Remote Asset is an asset but its content is not uploaded and stored on Comet. Rather a link for its location is stored so you can identify and distinguish between two experiment using different version of a dataset stored somewhere else.

Args:

  • uri: String - the remote asset location, there is no imposed format and it could be a private link.
  • logical_path: String, Optional. The "name" of the remote asset, could be a dataset name, a model file name.
  • overwrite: if True will overwrite all existing assets with the same name.
  • metadata: Some additional data to attach to the the remote asset. Must be a JSON-encodable dict.