Hectiq Lab

Artifacts

Artifacts are any files than should be kept during a machine learning experiment. Usually, this includes figures, images and dataframe. Models and dataset have a specific repertoire in Hectiq Lab, but you can add any file you want to the artifacts.

In the object-oriented approach, artifacts are accessible using run methods (Run.add_artifact) and artifacts methods (Artifact.create). These approaches are equivalent, except that Artifact.create needs the run and the project.

Add an artifact

Any file

You can add an artifact to the run using the add_artifact method. Artifact is a file that you want to store in the run.

import pyhectiqlab.functional as hl
hl.add_artifact(path="path/to/file")
NameTypeDefaultDescription
pathstr-Path to the file to upload.
namestr, optionalNoneName of the artifact or the group of artifacts. If None, the name is the basename of the file.
stepint, optionalNoneThe optional step stamp of the artifacts. If None, the artifacts is not considered as a step artifact.
run_idstr, optionalNoneID of the run. If None, the current run ID is used.
projectstr, optionalNoneThe project of the artifact. If None, the current project is used.
wait_responseboolFalseSet to true to upload sync. If False, the upload is made in background.

Matplotlib figure

For matplotlib, you can use the add_figure method to add a figure to the run. The figure will be saved to png and stored as an artifact. This method is only availabe from the functional and run object-oriented approach.

import pyhectiqlab.functional as hl
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
hl.add_figure(figure=fig, name="my-figure")
NameTypeDefaultDescription
figurematplotlib.pyplot.Figure-The figure to save.
namestr-The name of the artifact.
stepOptional[int]NoneThe optional step stamp of the artifacts. If None, the artifacts is not considered as a step artifact.
dpiint200The dpi of the figure.
extensionstr"png"The extension of the figure.
wait_responseboolFalseSet to true to upload sync. If False, the upload is made in background.
run_idOptional[str]NoneThe run of the artifact. If None, the current run is used.
projectOptional[str]NoneThe project of the artifact. If None, the current project is used.

Download an artifact

You can download an artifact using the download method. This method is only available from the functional and artifact object-oriented approach.

The download uses tqdm to display the progress of the download.

import pyhectiqlab.functional as hl
hl.download_artifact(id="9c29ckw0")
NameTypeDefaultDescription
idstr-ID of the artifact.
pathstr'./'Path to save the file.

Retrieve informations on artifact

You can retrieve informations on an artifact using the retrieve method. This method is only available from the functional and artifact object-oriented approach.

import pyhectiqlab.functional as hl
hl.get_artifact(id="9c29ckw0")
NameTypeDefaultDescription
idstr-ID of the artifact.
fieldsList[str], optionalNoneList of fields to retrieve.

Delete an artifact

You can delete an artifact using the delete method. This method is only available from the functional and artifact object-oriented approach.

import pyhectiqlab.functional as hl
hl.delete_artifact(id="9c29ckw0")
NameTypeDefaultDescription
idstr-ID of the artifact.
wait_responseboolFalseSet to true to delete sync. If False, the deletion is made in background.

List artifacts

You can list artifacts using the list method. This method is only available from the functional and artifact object-oriented approach.

import pyhectiqlab.functional as hl
hl.list_artifacts(run_id="9c29ckw0", project="hectiq-ai/demo")
NameTypeDefaultDescription
run_idstr-ID of the run.
projectstr, optionalNoneID of the project.
fieldsList[str], optionalNoneList of fields to retrieve.
group_by_stepbool, optionalTrueSet to True to group the artifacts by step.
pageint, optional1Page number.
limitint, optional50Number of artifacts to retrieve per page.
order_bystr, optional"name"Field to order by.
order_directionstr, optional"asc"Order direction.

On this page