MLOps Quick Reference Guide
Quick reference for MLOps tools and practices.
Table of Contents
- Version Control
- Experiment Tracking
- Model Registry
- CI/CD
- Common Issues & Solutions
- Best Practices Checklist
Version Control
DVC Commands
# Initialize
dvc init
# Track files
dvc add data/train.csv
# Create pipeline
dvc run -n step -d input -o output python script.py
# Reproduce
dvc repro
Git LFS
# Install
git lfs install
# Track
git lfs track "*.pkl"
Experiment Tracking
MLflow
import mlflow
mlflow.set_experiment("experiment")
with mlflow.start_run():
mlflow.log_param("param", value)
mlflow.log_metric("metric", value)
mlflow.sklearn.log_model(model, "model")
Weights & Biases
import wandb
wandb.init(project="project")
wandb.log({"metric": value})
Model Registry
# Register
mlflow.register_model("runs:/<id>/model", "ModelName")
# Transition
client.transition_model_version_stage("ModelName", 1, "Production")
CI/CD
GitHub Actions
- name: Run tests
run: pytest
- name: Train model
run: python train.py
Common Issues & Solutions
Issue 1: Large Files in Git
Solution: Use DVC or Git LFS
Issue 2: Lost Experiments
Solution: Use MLflow from the start
Best Practices Checklist
- Version control code, data, models
- Track all experiments
- Use model registry
- Set up CI/CD
- Document everything
- Monitor models in production
Try next: Version one model artifact and record how you would roll it back.