Skip to main content

MLflow

ML 실험 관리 및 모델 레지스트리 플랫폼입니다. 머신러닝/딥러닝 실험의 파라미터, 메트릭, 모델을 추적하고 비교할 수 있습니다.

어디에 쓰이나요?

  • 실험 추적(Tracking): 학습 파라미터(learning rate, batch size 등), 메트릭(accuracy, loss 등), 모델 파일을 기록하고 비교
  • 모델 레지스트리: 학습된 모델의 버전을 관리하고, Staging → Production 단계 전환
  • 모델 서빙: 등록된 모델을 REST API로 배포
  • 재현성: 실험 환경(코드, 데이터, 파라미터)을 기록하여 동일 결과 재현
PyTorch, TensorFlow, scikit-learn, XGBoost, HuggingFace 등 주요 ML 프레임워크와 통합됩니다.

Docker Compose

docker-compose.yml
services:
  mlflow:
    image: ghcr.io/mlflow/mlflow:latest
    container_name: mlflow
    restart: unless-stopped
    ports:
      - "5000:5000"
    environment:
      - MLFLOW_BACKEND_STORE_URI=sqlite:///mlflow/mlflow.db
      - MLFLOW_DEFAULT_ARTIFACT_ROOT=/mlflow/artifacts
    volumes:
      - mlflow_data:/mlflow
    command: >
      mlflow server
      --host 0.0.0.0
      --port 5000
      --backend-store-uri sqlite:///mlflow/mlflow.db
      --default-artifact-root /mlflow/artifacts

volumes:
  mlflow_data:

PostgreSQL 연동 구성

docker-compose.yml
services:
  mlflow:
    image: ghcr.io/mlflow/mlflow:latest
    container_name: mlflow
    restart: unless-stopped
    ports:
      - "5000:5000"
    volumes:
      - mlflow_artifacts:/mlflow/artifacts
    command: >
      mlflow server
      --host 0.0.0.0
      --port 5000
      --backend-store-uri postgresql://postgres:changeme@mlflow-db:5432/mlflow
      --default-artifact-root /mlflow/artifacts
    depends_on:
      mlflow-db:
        condition: service_healthy

  mlflow-db:
    image: postgres:17-alpine
    container_name: mlflow-db
    restart: unless-stopped
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=changeme
      - POSTGRES_DB=mlflow
    volumes:
      - mlflow_db_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 3s
      timeout: 3s
      retries: 10

volumes:
  mlflow_artifacts:
  mlflow_db_data:

실행

docker compose up -d

접속 확인

브라우저에서 http://localhost:5000으로 접속합니다.

기본 정보

항목
웹 UI 포트5000
기본 데이터베이스SQLite (내장)

Python SDK 연동

import mlflow

mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("my-experiment")

with mlflow.start_run():
    mlflow.log_param("learning_rate", 0.001)
    mlflow.log_metric("accuracy", 0.95)
    mlflow.log_artifact("model.pkl")

라이선스

구분내용
라이선스Apache License 2.0
개인 사용자유롭게 사용 가능
상업적 사용자유롭게 사용 가능, 수정/재배포 제한 없음

참고