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__

python __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:

```python 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:

```python 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

python 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

python add_remote(self, uri, logical_path=None, overwrite=False, asset_type=None, metadata=None, sync_mode=True, max_synced_objects=10000)

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.
  • asset_type: Define the type of the asset - Deprecated.
  • metadata: Some additional data to attach to the remote asset. Must be a JSON-encodable dict.
  • sync_mode: Bool - If True and the URI begins with s3://, Comet attempts to list all objects in the given bucket and path. Each object will be logged as a separate remote asset. If object versioning is enabled on the S3 bucket, Comet also logs each object version to be able to download the exact version. If False, Comet just logs a single remote asset with the provided URI as the remote URI. Default is True.
  • max_synced_objects: When sync_mode is True and the URI begins with s3://, set the maximum number of S3 objects to log. If there are more matching S3 objects than max_synced_objects, a warning will be displayed and the provided URI will be logged as a single remote asset.