Artifact Management
list
list
Lists all artifacts in the project.
Parameters
Name | Type | Description |
---|---|---|
filters | dict | A dictionary containing the filters of the artifacts to be returned. |
include_exports | bool | The boolean indication on whether to return the exported models. Default is False. |
Return
A list of msgspec structs containing the artifact metadata with the following structure:
[Artifact(
id='artifact_65a7678a91afa7d22455c5ba',
project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
run_id='run_699baa54-f607-4c1b-9403-a015a0b4ff1c',
is_training=False,
step=3000,
metric=ArtifactMetric(
total_loss=0.059123,
classification_loss=0.050808,
localization_loss=0.0017339,
regularization_loss=0.006581
),
flow_title='Cell Detector',
artifact_name='ckpt-12',
create_date=1705469834692,
is_deployed=False,
model_name='efficientdet-d1-640x640',
export_options=[
ArtifactExportOptions(
format='ONNX',
optimizations=ArtifactExportOptimizations(
quantization=['float32', 'float16']
),
default_optimizations=ArtifactExportOptimizations(
quantization='float32'
)
),
ArtifactExportOptions(
format='TensorFlow',
optimizations=ArtifactExportOptimizations(
quantization=['float32']
),
default_optimizations=ArtifactExportOptimizations(
quantization='float32'
)
),
],
exports=[
ArtifactModel(
id='model_5x6yy4q204538r3479q1351vw6w006r6',
artifact_id='artifact_65a7678a91afa7d22455c5ba',
status='Finished',
format='Tensorflow',
quantization="float32",
create_date=1705472326144,
download=DownloadSignedUrl(
method='GET',
expiry_date=1705558963838,
url='https://storage.googleapis.com/699baa54-f607-4c1b-9403-a015a0b4ff1c-ckpt-12-tensorflow.zip'
)
),
]
)]
Examples
- List all artifacts in the project:
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.list(
filters={
"run_ids": ['run_699baa54-f607-4c1b-9403-a015a0b4ff1c']
},
include_exports=True
)
- List artifact with workflow name "My Awesome Workflow":
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.list(include_exports=True)
artifact = [
a for a in project.artifacts.list()
if a.flow_title == "My Awesome Workflow"
][0]
get
get
Retrieves a specific artifact using the artifact ID.
Parameters
Name | Type | Description |
---|---|---|
artifact_id | str | The ID of the artifact as a string. |
include_exports | bool | The boolean indication on whether to return the exported models. Default is False |
Return
A msgspec struct containing the specific artifact metadata with the following structure:
Artifact(
id='artifact_65a7678a91afa7d22455c5ba',
project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
run_id='run_699baa54-f607-4c1b-9403-a015a0b4ff1c',
is_training=False,
step=3000,
metric=ArtifactMetric(
total_loss=0.059123,
classification_loss=0.050808,
localization_loss=0.0017339,
regularization_loss=0.006581
),
flow_title='Cell Detector',
artifact_name='ckpt-12',
create_date=1705469834692,
is_deployed=False,
model_name='efficientdet-d1-640x640',
export_options=[
ArtifactExportOptions(
format='ONNX',
optimizations=ArtifactExportOptimizations(
quantization=['float32', 'float16']
),
default_optimizations=ArtifactExportOptimizations(
quantization='float32'
)
),
ArtifactExportOptions(
format='TensorFlow',
optimizations=ArtifactExportOptimizations(
quantization=['float32']
),
default_optimizations=ArtifactExportOptimizations(
quantization='float32'
)
),
],
exports=[
ArtifactModel(
id='model_5x6yy4q204538r3479q1351vw6w006r6',
artifact_id='artifact_65a7678a91afa7d22455c5ba',
status='Finished',
format='Tensorflow',
quantization="float32",
create_date=1705472326144,
download=DownloadSignedUrl(
method='GET',
expiry_date=1705558963838,
url='https://storage.googleapis.com/699baa54-f607-4c1b-9403-a015a0b4ff1c-ckpt-12-tensorflow.zip'
)
),
]
)
Examples
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.get("artifact_63bd140e67b42dc9f431ffe2", include_exports=True)
list_exported_models
list_exported_models
Lists all exported models of a specific artifact.
Parameters
Name | Type | Description |
---|---|---|
artifact_id | str | The ID of the artifact as a string. |
Return
A list of msgspec structs with the exported model metadata with the following structure:
[ArtifactModel(
id='model_5x6yy4q204538r3479q1351vw6w006r6',
artifact_id='artifact_65a7678a91afa7d22455c5ba',
status='Finished',
format='Tensorflow',
quantization="float32",
create_date=1705472326144,
download=DownloadSignedUrl(
method='GET',
expiry_date=1705558963838,
url='https://storage.googleapis.com/699baa54-f607-4c1b-9403-a015a0b4ff1c-ckpt-12-tensorflow.zip'
)
)]
Examples
- List all exported models by specific artifact ID:
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.list_exported_models("artifact_63bd140e67b42dc9f431ffe2")
- List the Tensorflow model export of the artifact:
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
artifact_id = "artifact_63bd140e67b42dc9f431ffe2"
tf_model = next((model
for model in project.artifacts.list_exported_models(artifact_id)
if model.format == "Tensorflow"), None)
create_export
create_export
Exports an artifact model in a specific model format. Model export may take up to 10 minutes to generate depending on the export format. This creates a download link that you can retrieve using artifacts.download_exported_model, together with the artifact model id in the return msgspec struct.
The process may take 3 to 10 minutes or more.
The export time depends on the size of the model, usually within 10 minutes. You can use list_exported_models to get the status, and once the status changes to
Finished
call download_exported_model to download the model.
Parameters
Name | Type | Description |
---|---|---|
artifact_id | str | The ID of the artifact as a string. |
export_metadata | dict | The export metadata for the export. |
Return
A msgspec struct containing the operation metadata of the model export with the following structure:
ArtifactModel(
id='model_15x95x513v9yrvvx2x329vvr34308w96',
artifact_id='artifact_63bd140e67b42dc9f431ffe2',
status='Queued',
format='Pytorch',
quantization="float32",
create_date=1701927649302,
download=None
)
Examples
- Export the Tensorflow model of a specific artifact:
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.create_export(
"artifact_63bd140e67b42dc9f431ffe2",
{
"format": "Pytorch"
}
)
- Export the Tensorflow model of a specific artifact and download to local:
import wget
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.create_export(
"artifact_63bd140e67b42dc9f431ffe2",
"Tensorflow"
)
while True:
model = next(
(model for model in project.artifacts.list_exported_models("artifact_63bd140e67b42dc9f431ffe2")
if model.format == 'Tensorflow' and model.status == 'Finished'), None)
if model:
wget(model.download.url)
break
download_exported_model
download_exported_model
Download and unzip an exported artifact model to the local path.
Parameters
Name | Type | Description |
---|---|---|
model_id | str | The ID of the exported artifact model as a string. |
path | str | The folder path to download the exported artifact model. Default is the current path. |
Return
A msgspec struct containing the download path of the model:
LocalArtifact(
download_path='local',
model_filename='datature-yolov8l.pt',
label_filename='label_map.pbtxt'
)
Examples
from datature.nexus import Client
project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.artifacts.download_exported_model(
"model_2q510q03x26882r4295x8y92yyqqqvq3"
path="./local"
)
Updated 8 months ago