Spaces:
Sleeping
Sleeping
your_username commited on
Commit ·
b08b495
1
Parent(s): ecdc3d7
Initial MLflow Server setup
Browse files- Dockerfile +33 -0
- README.md +19 -6
- requirements.txt +3 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Image de base : Python 3.10 (compatible MLflow).
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Création d'un utilisateur non-root (exigence Hugging Face).
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
+
|
| 9 |
+
# Dossier de travail.
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# Installation de MLflow et de ses dépendances.
|
| 13 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 14 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Création des dossiers nécessaires au stockage MLflow.
|
| 17 |
+
RUN mkdir -p /app/mlruns /app/mlartifacts
|
| 18 |
+
|
| 19 |
+
# Port d'écoute (imposé par Hugging Face Spaces).
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
# Lancement du serveur MLflow.
|
| 23 |
+
# --host 0.0.0.0 : écoute sur toutes les interfaces réseau
|
| 24 |
+
# --port 7860 : port imposé par HF
|
| 25 |
+
# --backend-store-uri : où stocker les métriques et hyperparamètres (SQLite local)
|
| 26 |
+
# --default-artifact-root : où stocker les modèles entraînés (dossier local)
|
| 27 |
+
# --serve-artifacts : laisse MLflow servir aussi les artefacts (modèles) via HTTP
|
| 28 |
+
CMD ["mlflow", "server", \
|
| 29 |
+
"--host", "0.0.0.0", \
|
| 30 |
+
"--port", "7860", \
|
| 31 |
+
"--backend-store-uri", "sqlite:///app/mlflow.db", \
|
| 32 |
+
"--default-artifact-root", "/app/mlartifacts", \
|
| 33 |
+
"--serve-artifacts"]
|
README.md
CHANGED
|
@@ -1,11 +1,24 @@
|
|
| 1 |
---
|
| 2 |
-
title: MLflow Server
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
| 8 |
-
license: mit
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: MLflow Tracking Server
|
| 3 |
+
emoji: 📈
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# MLflow Tracking Server
|
| 12 |
+
|
| 13 |
+
Serveur MLflow distant pour tracker mes expériences de machine learning.
|
| 14 |
+
|
| 15 |
+
## Accès
|
| 16 |
+
|
| 17 |
+
L'interface UI est accessible à l'URL du Space.
|
| 18 |
+
|
| 19 |
+
Depuis un script Python local, configurer :
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
import mlflow
|
| 23 |
+
mlflow.set_tracking_uri("https://elicopter6-mlflow-server.hf.space")
|
| 24 |
+
```
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mlflow==2.16.2
|
| 2 |
+
psycopg2-binary
|
| 3 |
+
boto3
|