Hectiq Lab

Artifacts

An artifact is a file a run keeps: a figure, a table, a report. Datasets and models have their own pages; an artifact is any other file.

Add an artifact

import hectiqlab as hl

hl.artifacts.create("confusion.png")
NameTypeDefaultDescription
pathstrThe file.
runstr or intNoneThe run's id or rank. The open run otherwise.
namestrNoneIts name. The file's name otherwise.
groupstrNoneWhat it is a version of.
stepintNoneWhen in the run it was written, to order a group's versions.
projectstrNoneThe project. The open run's otherwise.
progressboolNoneDraw a progress bar or not. See Settings.
locationstrNoneA bucket of your own, "gs://bucket", the file goes into. HECTIQLAB_BUCKET, else Hectiq Lab's own bucket, otherwise. See below.
any_sizeboolFalseUpload it whatever HECTIQLAB_UPLOAD_LIMIT says. --any-size on the CLI.

create returns a Future at once, and the file uploads in the background. The open run waits for the upload before it ends. Call .result() on the future to wait for it yourself.

An artifact over HECTIQLAB_UPLOAD_LIMIT isn't uploaded, and its Future gives None: one log line says why, and the run goes on. When the prompt asks for artifacts, it asks instead, once per name in a run. See Size limits and disk room. With the SDK switched off, the Future gives None too.

In your own bucket

With location="gs://acme", or HECTIQLAB_BUCKET=gs://acme, the file uploads with your own Google login into a new folder Hectiq Lab names after the artifact, gs://acme/artifacts/<id>/. It needs pip install "hectiqlab[gcs]". Hectiq Lab keeps only its record: the web app shows no preview of it, and deleting the artifact leaves its file in your bucket. download fetches it from your bucket.

This needs an API that knows the artifact's location: Hectiq Lab's API ships it first. An older one keeps no location: create then fails, and nothing is uploaded. Its record is left in the run, with no file, and the error names it.

To save a matplotlib figure, write it to a file first: fig.savefig("confusion.png").

Versions of one artifact

Artifacts that share a group are versions of one another, ordered by step:

for epoch in range(10):
    ...
    fig.savefig("confusion.png")
    hl.artifacts.create("confusion.png", group="confusion", step=epoch)

List a run's artifacts

artifacts = hl.artifacts.list(42).unwrap()

Only the latest version of each group is listed. Pass keep_latest_step=False, or --all, for every version, and group= for one group.

Download an artifact

path = hl.artifacts.download("art_4f2c", "downloads/").result()

hl.artifacts.get("art_4f2c") reads the artifact instead, with download_url: an address its file can be fetched from for a day, for an artifact in Hectiq Lab's bucket.

A download that doesn't fit on its disk fails before any byte moves. See Size limits and disk room.

Delete an artifact

hl.artifacts.delete("art_4f2c")

On this page