Artifact Management
Artifacts are files associated with experiment runs -- trained models, datasets, plots, configuration files, evaluation reports, and any other binary or text data relevant to reproducing or understanding a training run.
Uploading Artifacts
POST /api/v1/experiments/runs/{run_id}/log-artifact
Content-Type: multipart/form-data
X-Tenant-ID: acme-corp
file: @model.pkl
artifact_path: models/Response
{
"message": "Artifact logged",
"run_id": "...",
"artifact": "models/model.pkl"
}Artifact Types
| Type | Extension | Example |
|---|---|---|
| Serialized models | .pkl, .joblib, .pt, .h5 | model.pkl |
| ONNX models | .onnx | model.onnx |
| Configuration | .json, .yaml | hyperparams.json |
| Evaluation plots | .png, .svg | confusion_matrix.png |
| Data samples | .csv, .parquet | test_predictions.csv |
| Text reports | .txt, .md | evaluation_report.md |
SDK Artifact Methods
The ExperimentTracker provides several methods for artifact logging:
with tracker.start_run(experiment_name="fraud-detection") as run:
# Log a single file
run.log_artifact("/tmp/model.pkl", artifact_path="models")
# Log a dictionary as JSON
run.log_dict(
{"threshold": 0.5, "features": ["amount", "frequency"]},
"config/model_config.json"
)
# Log text content
run.log_text(
"Model achieved 91.2% accuracy on holdout set",
"reports/summary.txt"
)
# Log a matplotlib figure
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(losses)
run.log_artifact.__self__._tracker.log_figure(fig, "plots/loss_curve.png")Storage Location
Artifacts are stored in S3-compatible object storage. The default location is derived from the experiment:
s3://matih-artifacts/experiments/{experiment_id}/runs/{run_id}/artifacts/This can be overridden per experiment via the artifact_location field at creation time.
Artifact Directory Logging
To log an entire directory of artifacts:
tracker.log_artifacts("/path/to/artifacts/directory", artifact_path="evaluation")This uploads all files in the directory to {artifact_uri}/evaluation/.
Source Files
| File | Path |
|---|---|
| Artifact Upload Endpoint | data-plane/ml-service/src/api/experiments.py |
| ArtifactManager | data-plane/ml-service/src/tracking/artifact_manager.py |
| EnhancedArtifactService | data-plane/ml-service/src/tracking/enhanced_artifact_service.py |