dieumercimvemba commited on
Commit
46f4c81
·
verified ·
1 Parent(s): 2d51056

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -48
Dockerfile CHANGED
@@ -1,68 +1,40 @@
1
  # ----------------------------------------------------
2
- # Dockerfile Comfy UI (Mode CPU) - V19 (CORRECTION FINALE DU VAE)
3
- # Correction: Le nom du fichier VAE est incorrect. Utilise maintenant 'vae.safetensors'
4
- # du dépôt Stability AI (résout le 404 sur le VAE).
5
  # ----------------------------------------------------
6
 
7
  # 1. Image de base
8
  FROM python:3.11-slim
9
-
10
- # Définir le répertoire de travail
11
  WORKDIR /app
12
-
13
- # 2. Installation des dépendances système
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
15
  git \
16
  libglib2.0-0 \
17
  curl \
18
- wget \
19
  && rm -rf /var/lib/apt/lists/*
20
-
21
- # 3. Installation de ComfyUI
22
  RUN git clone https://github.com/comfyanonymous/ComfyUI.git
23
-
24
  WORKDIR /app/ComfyUI
25
 
26
- # 4. Installation des dépendances Python (incluant hf_hub pour téléchargement robuste)
27
- RUN pip install torch==2.3.1+cpu torchvision==0.18.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
28
- RUN pip install -r requirements.txt
29
- RUN pip install huggingface_hub
30
 
31
- # 5. Création du répertoire des modèles
32
- RUN mkdir -p models/checkpoints models/vae
 
33
 
34
- # 6. Téléchargement des 2 Modèles (Stable Diffusion 1.5 + VAE)
35
- RUN echo "import os, glob\n\
36
- from huggingface_hub import hf_hub_download\n\
37
- \n\
38
- # 1. Nettoyage des anciens fichiers\n\
39
- for f in glob.glob(os.path.join('models', '*', '*.safetensors')):\n\
40
- os.remove(f)\n\
41
- \n\
42
- # 2. Téléchargement du Checkpoint (Stable Diffusion 1.5 - Public et Non Gated)\n\
43
- CHECKPOINT_REPO = 'runwayml/stable-diffusion-v1-5'\n\
44
- CHECKPOINT_FILE = 'v1-5-pruned-emaonly.safetensors'\n\
45
- CHECKPOINT_DIR = 'models/checkpoints'\n\
46
- print('--- 1/2 Downloading Checkpoint: {} ---'.format(CHECKPOINT_FILE))\n\
47
- hf_hub_download(repo_id=CHECKPOINT_REPO, filename=CHECKPOINT_FILE, local_dir=CHECKPOINT_DIR)\n\
48
- \n\
49
- # 3. Téléchargement du VAE (VAE officiel de Stability AI - Nom de fichier corrigé)\n\
50
- VAE_REPO = 'stabilityai/sd-vae-ft-mse'\n\
51
- VAE_SOURCE_FILE = 'vae.safetensors'\n\
52
- VAE_DEST_FILE = 'vae.safetensors'\n\
53
- VAE_DIR = 'models/vae'\n\
54
- print('--- 2/2 Downloading VAE ({}) ---'.format(VAE_SOURCE_FILE))\n\
55
- # Utilisation de allow_patterns pour garantir le téléchargement du fichier à la racine\n\
56
- hf_hub_download(repo_id=VAE_REPO, allow_patterns=VAE_SOURCE_FILE, local_dir=VAE_DIR, local_file_on_download=VAE_DEST_FILE)\n\
57
- print('Successfully saved VAE as {} in {}'.format(VAE_DEST_FILE, VAE_DIR))\n\
58
- " > download_models_v19.py
59
 
60
- RUN python3 download_models_v19.py
 
61
 
62
- # 7. Ajout du noeud pour la sauvegarde d'image par WebSocket
63
- RUN mkdir -p custom_nodes
64
- RUN curl -L https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/custom_nodes/websocket_image_save.py -o custom_nodes/websocket_image_save.py
65
 
66
- # 8. Démarrage de l'application
 
67
  EXPOSE 7860
68
- CMD ["python3", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--disable-metadata"]
 
 
 
1
  # ----------------------------------------------------
2
+ # Dockerfile Comfy UI (Mode GPU) - VERSION FINALE
 
 
3
  # ----------------------------------------------------
4
 
5
  # 1. Image de base
6
  FROM python:3.11-slim
 
 
7
  WORKDIR /app
 
 
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  git \
10
  libglib2.0-0 \
11
  curl \
 
12
  && rm -rf /var/lib/apt/lists/*
 
 
13
  RUN git clone https://github.com/comfyanonymous/ComfyUI.git
 
14
  WORKDIR /app/ComfyUI
15
 
16
+ # 4. Installation des dépendances Python (CRITIQUE : POUR GPU)
17
+
18
+ # FIX 1 : On garde NumPy 1.x
19
+ RUN pip install "numpy<2.0"
20
 
21
+ # FIX 2 : Installation de PyTorch 2.3.1 pour CUDA 11.8 (NÉCESSAIRE POUR GPU)
22
+ # Ceci est l'URL de l'installation GPU.
23
+ RUN pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
24
 
25
+ # FIX 3 : Installation des dépendances standards
26
+ RUN pip install -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ # FIX 4 : On force une version récente de Transformers
29
+ RUN pip install transformers==4.41.2
30
 
31
+ # 5. Téléchargement du modèle SD 1.5
32
+ RUN mkdir -p models/checkpoints \
33
+ && curl -L "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" -o ./models/checkpoints/v1-5-pruned-emaonly.safetensors
34
 
35
+ # 6. Configuration Hugging Face
36
+ ENV PORT 7860
37
  EXPOSE 7860
38
+
39
+ # 7. Lancement (On retire le --cpu car nous sommes en GPU)
40
+ CMD ["python3", "main.py", "--listen", "0.0.0.0", "--port", "7860"]