Create and Manage Models

Create models in Model Hub, generate versions from training executions, manage approval states, and use models in production pipelines.


Overview

Model Hub workflow:

  1. Create model — Define model in registry (one-time setup)

  2. Train model — Run training execution

  3. Create version — Automatically add model version from outputs

  4. Review & approve — Validate metrics, approve for production

  5. Deploy — Use model:// URI in production workflows


Create a Model

Models are containers for versions. Create a model once, then add multiple versions over time.

Via Web UI

  1. Navigate to Models (in project or organization view)

  2. Click "Create Model"

  3. Enter Model name (e.g., "flower")

  4. Optionally associate with a project

  5. Click "Create"

⚠️ Important: The model URI (flower) becomes model://flower/ and cannot be changed later. Choose carefully.


Project-Associated Models

Organization view: All models visible Project view: Only associated models visible (cleaner organization)

To associate:

  • Creating from project view → Automatically associated

  • Creating from org view → Choose project during creation

  • Change later → Organization Settings → Models

Benefit: Organize models by project while still using them across projects.


Create Model Versions from Training

The recommended approach: automatically create model versions when training executions complete.

Step 1: Train and Save Model

train.py:


Step 2: Create Model Version with Metadata

In your train.py add valohai.model-versions metadata to create model version automatically:

What happens:

  1. Execution saves model.pkl to /valohai/outputs/

  2. Metadata file tells Valohai to add this to model://flower/

  3. New model version created in Pending state

  4. Version includes model.pkl and all metadata


Step 3: Add Release Notes and Tags

Include additional metadata for the version:

Metadata fields:

  • model_uri — Which model to add version to

  • model_version_tags — Tags specific to this version

  • model_release_note — Description of changes/improvements

  • Custom properties — Any metrics or context (accuracy, etc.)


Complete Training Example

train.py:

valohai.yaml:

Result:

  • ✅ Model version created in Model Hub

  • ✅ State: Pending (awaiting approval)

  • ✅ Files: model.pkl, feature_importance.csv

  • ✅ Metadata: Metrics, tags, release notes

  • ✅ Lineage: Linked to training execution and data


Model Version States

Every model version has a state in the approval workflow.

Pending (Initial State)

What it means: Newly created, awaiting review

When to use: All new model versions start here

Actions available:

  • Review metrics and lineage

  • Compare to previous versions

  • Approve or reject


Approved

What it means: Validated for production use

When to use: Model meets quality criteria and is ready for deployment

Actions available:

  • Use in production pipelines

  • Compare to other approved versions

  • Revert to pending if issues found

How to approve:

  1. Open model version in UI

  2. Review metrics and artifacts

  3. Click "Approve" button

  4. Add approval notes (optional)

Approval controls for a model version

Rejected

What it means: Not suitable for production

When to use: Model fails quality checks, shows bias, or has issues

Actions available:

  • Document rejection reason

  • Use rejection notes to inform next iteration

  • Cannot use in production (intentionally blocked)

How to reject:

  1. Open model version in UI

  2. Click "Reject" button

  3. Required: Add rejection reason

  4. Common reasons: "Overfitting on test set", "Bias detected in predictions", "Worse than baseline"


Model Version Numbers

Versions are automatically numbered sequentially:

Special aliases:

💡 Tip: Use latest alias for production deployments that should automatically use newest approved version.


Use Models in Workflows

As Execution Input

valohai.yaml:

predict.py:


Using Latest Approved Version

Benefit: Update model version, approve it, and all production pipelines automatically use the new version on next run.



Create Model Version via UI

For existing model files not from training executions:

  1. Navigate to your model

  2. Click "Create Version"

  3. Search for files in data library

  4. Select model file(s)

  5. Add version tags and release notes

  6. Click "Create"

Use cases:

  • Import externally trained models

  • Promote experiment checkpoints to model registry

  • Add models trained outside Valohai


Manage Multiple Files per Version

A model version can contain multiple files:

Result: All three files included in the version:

Access in inference:


Legacy Approach: Sidecar Metadata Files

The older approach used individual .metadata.json files:

This still works, but JSONL format is recommended for:

  • Consolidating metadata for multiple files

  • Cleaner outputs directory

  • Consistency with dataset versioning


Find Model URI

In Model Hub UI:

  1. Navigate to your model

  2. Select a version

  3. Copy model URI from version details panel

Format:


Common Workflow: Train → Approve → Deploy

Step 1: Train Model

Result: New version created in Pending state


Step 2: Review & Approve

  1. Open Model Hub → Find model

  2. View new version (Pending)

  3. Review:

    • Training metrics

    • Lineage (which data was used)

    • Compare to previous versions

  4. Click "Approve"

  5. Add approval notes: "Approved for staging deployment - 3% improvement in recall"

Result: Version state changed to Approved


Step 3: Deploy

Option A: Update deployment to use new version:

Option B: Use latest alias (automatic):

Result: Production system now uses approved model v5. Model can be used for inference inside Valohai executions or deployed outside Valohai to your serving infrastructure.


Best Practices

Descriptive Model Names


Use Release Notes


Tag Strategically


Include Key Metrics


Review Before Approving

Checklist:

  • ✅ Metrics better than baseline

  • ✅ No overfitting (train vs test performance similar)

  • ✅ Lineage verified (correct training data)

  • ✅ Fairness/bias checked

  • ✅ Comparison to previous version documented



Next Steps

  • Create your first model in Model Hub

  • Train a model and create a version automatically

  • Set up approval workflow with your team

  • Deploy using model:// URIs

Last updated

Was this helpful?