nself includes MLflow for ML experiment tracking, model versioning, and model registry. The nself mlflow command provides easy management of your ML workflow.
| Command | Description |
|---|---|
nself mlflow | Show status |
nself mlflow enable | Enable MLflow service |
nself mlflow disable | Disable MLflow service |
nself mlflow open | Open MLflow UI in browser |
nself mlflow configure <setting> <value> | Configure settings |
nself mlflow experiments | List experiments |
nself mlflow experiments create <name> | Create experiment |
nself mlflow experiments delete <id> | Delete experiment |
nself mlflow runs [exp_id] | List runs |
nself mlflow test | Test connection |
nself mlflow logs [-f] | View logs |
MLflow requires:
MINIO_ENABLED=true)# Enable MLflow
nself mlflow enable
# Rebuild to add the MLflow container
nself build && nself start
# Open MLflow UI
nself mlflow open
# Check status
nself mlflow status# List all experiments
nself mlflow experiments list
# Create a new experiment
nself mlflow experiments create "My Experiment"
# Delete an experiment by ID
nself mlflow experiments delete 1# List runs from default experiment
nself mlflow runs
# List runs from experiment ID 1
nself mlflow runs 1
# List runs by experiment name
nself mlflow runs "My Experiment"Log experiments from your Python ML code:
import mlflow
# Set tracking URI to your nself MLflow instance
mlflow.set_tracking_uri("http://mlflow.local.nself.org")
# Create or set experiment
mlflow.set_experiment("text-classification")
# Start a run
with mlflow.start_run():
# Log parameters
mlflow.log_param("learning_rate", 0.01)
mlflow.log_param("epochs", 100)
# Train your model...
model = train_model(learning_rate=0.01, epochs=100)
# Log metrics
mlflow.log_metric("accuracy", 0.95)
mlflow.log_metric("f1_score", 0.93)
# Log model
mlflow.sklearn.log_model(model, "model")
# Log artifacts (plots, data files, etc.)
mlflow.log_artifact("confusion_matrix.png")Register and version your models:
import mlflow
# Register a model
model_uri = "runs:/<run_id>/model"
mlflow.register_model(model_uri, "TextClassifier")
# Load a registered model
model = mlflow.pyfunc.load_model("models:/TextClassifier/Production")
# Transition model stage
client = mlflow.tracking.MlflowClient()
client.transition_model_version_stage(
name="TextClassifier",
version=1,
stage="Production"
)Environment variables for MLflow:
# Enable MLflow
MLFLOW_ENABLED=true
MLFLOW_VERSION=2.9.2
MLFLOW_PORT=5000
# Authentication (auto-generated on first enable)
MLFLOW_USERNAME=admin
MLFLOW_PASSWORD=your-password
# Artifact storage (uses MinIO when enabled)
MLFLOW_DB_NAME=mlflow
MLFLOW_ARTIFACTS_BUCKET=mlflow-artifacts# Set username
nself mlflow configure username admin
# Set/generate password
nself mlflow configure password
nself mlflow configure password mypassword
# Change port
nself mlflow configure port 5001MLflow is accessible at:
https://mlflow.local.nself.orghttps://mlflow.<your-domain>Ensure MLflow is enabled with nself mlflow status. Check if the container is running with nself status.
Verify the tracking URI matches your environment. For Docker, use the service name: http://mlflow:5000.
Ensure MinIO is enabled and configured correctly if using S3-compatible storage for artifacts.