C.W.K.
Stream
Lesson 10 of 12 · published

Model Registry

~10 min · registry, versioning, mlops

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Models need versioning too

'I trained a new model' is not enough information. Which model? What data? Which commit produced it? How did it score? A model registry answers these.

Common registries

  • Hugging Face Hub — public default; private orgs supported.
  • MLflow — open-source, self-hostable.
  • Weights & Biases (W&B) — full experiment tracking + registry.
  • SageMaker Model Registry — AWS-native.
  • Vertex AI Model Registry — GCP-native.

What metadata to record

  1. Source SHA (Git commit that produced the model).
  2. Training data version (DVC version, dataset SHA, S3 etag).
  3. Hyperparameters.
  4. Eval scores on the held-out set.
  5. Train environment (Docker image SHA, GPU type, library versions).
  6. Promotion stage (staging / production / archived).

CI integration

A successful training job uploads the model to the registry as 'staging'. A separate workflow (manual or scheduled) promotes to 'production' after eval gates pass. The serving stack pulls 'production' on startup.

Code

Push trained model to HF Hub on success·yaml
      - name: Train
        run: uv run python train.py --output ./out/
      - name: Eval
        id: eval
        run: |
          score=$(uv run python eval.py --model ./out/ --json | jq -r .accuracy)
          echo "score=$score" >> $GITHUB_OUTPUT
      - name: Push to HF Hub (staging only)
        if: steps.eval.outputs.score > 0.85
        env:
          HF_TOKEN: ${{ secrets.HF_TOKEN }}
        run: |
          uv run python -c "
          from huggingface_hub import HfApi
          HfApi().upload_folder(
            folder_path='./out',
            repo_id='my-org/my-model',
            revision='staging',
            commit_message='train: ${{ github.sha }} score=${{ steps.eval.outputs.score }}',
          )
          "

External links

Exercise

Pick a registry that fits your stack. Wire one training run to push the resulting model with metadata. Promote it from staging to production through a separate workflow that requires eval gates.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.