Spaces:
Paused
Paused
File size: 10,155 Bytes
80b207b d8f5652 0e2a07e 17ee3dc 80b207b 173f5c6 a0fb44a d64557a 46f4c81 ca2e68a 8fc1fe8 46f4c81 173f5c6 80b207b 173f5c6 46f4c81 7081048 a0fb44a c53db20 7081048 d64557a d8f5652 ca2e68a 5944eda d8f5652 c53db20 d8f5652 8fc1fe8 46f4c81 a0fb44a 46f4c81 173f5c6 8fc1fe8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# ----------------------------------------------------
# Dockerfile Comfy UI (Mode CPU) - V12 (Final avec deux Workflows)
# Workflows inclus : dreamshaper_8.safetensors et v1-5-pruned-emaonly.safetensors
# ------------------------------------------------------
# 1. Image de base
FROM python:3.11-slim
WORKDIR /app
# 2. Installation des dépendances système
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libglib2.0-0 \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 3. Clonage de ComfyUI
RUN git clone https://github.com/comfyanonymous/ComfyUI.git
WORKDIR /app/ComfyUI
# 4. Installation des dépendances Python (Mode CPU)
RUN pip install "numpy<2.0"
# Installation de PyTorch pour CPU
RUN pip install torch==2.3.1+cpu torchvision==0.18.1+cpu torchaudio==2.3.1+cpu --index-url https://download.pytorch.org/whl/cpu
RUN pip install -r requirements.txt
RUN pip install transformers==4.41.2 tokenizers==0.19.1
# 5. Téléchargement des modèles SD 1.5 (CHECKPOINTS)
RUN mkdir -p models/checkpoints \
&& 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
# 5A. Téléchargement du modèle Dreamshaper (FIX CORRUPTION/INCOMPLETUDE)
# Nous supprimons l'ancienne version et ajoutons l'option -f (fail fast) à curl pour éviter le caching d'un fichier corrompu.
RUN rm -f ./models/checkpoints/dreamshaper_8.safetensors \
&& echo "Starting fresh download of dreamshaper_8.safetensors (~4.0 GB)" \
&& curl -L -f "https://civitai.com/api/download/models/126689?type=Model&format=SafeTensor&size=full" -o ./models/checkpoints/dreamshaper_8.safetensors \
&& if [ ! -s ./models/checkpoints/dreamshaper_8.safetensors ]; then echo "Error: Download failed or file is empty!" && exit 1; fi
# 5C. AJOUT CRITIQUE : VAEs et CLIP
RUN mkdir -p models/vae models/clip \
&& curl -L "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors" -o ./models/vae/vae-ft-mse-840000-ema-pruned.safetensors \
&& curl -L "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/vae.pt" -o ./models/vae/vae.pt \
&& curl -L "https://huggingface.co/comfyanonymous/clip_g/resolve/main/clip_g.safetensors" -o ./models/clip/clip_g.safetensors
# 5D. AJOUT : Workflow 1 - Workflow par défaut (utilise Dreamshaper)
RUN echo '{ "last_node_id": 9, "last_link_id": 10, "nodes": [ { "id": 3, "type": "KSampler", "pos": [311, 281], "size": [337.89, 226.24], "flags": {}, "order": 4, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 6 }, { "name": "positive", "type": "CONDITIONING", "link": 7 }, { "name": "negative", "type": "CONDITIONING", "link": 8 }, { "name": "latent_image", "type": "LATENT", "link": 9 } ] }, { "id": 4, "type": "EmptyLatentImage", "pos": [38, 513], "size": [235.84, 105.85], "flags": {}, "order": 3, "mode": 0, "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [9], "shape": 3 } ] }, { "id": 6, "type": "SaveImage", "pos": [1021, 281], "size": [220, 50], "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 5 } ], "widgets_values": [ "ComfyUI" ] }, { "id": 7, "type": "CheckpointLoaderSimple", "pos": [38, 281], "size": [291.6, 98], "flags": {}, "order": 0, "mode": 0, "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [6], "shape": 3 }, { "name": "CLIP", "type": "CLIP", "links": [1, 2], "shape": 3 }, { "name": "VAE", "type": "VAE", "links": [4], "shape": 3 } ], "widgets_values": [ "dreamshaper_8.safetensors" ] }, { "id": 8, "type": "CLIPTextEncode", "pos": [38, 0], "size": [337.89, 150.11], "flags": {}, "order": 1, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 1 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [7], "shape": 3 } ], "widgets_values": [ "a photograph of an astronaut riding a horse, cinematic, epic" ] }, { "id": 9, "type": "CLIPTextEncode", "pos": [38, 175], "size": [337.89, 150.11], "flags": {}, "order": 2, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 2 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [8], "shape": 3 } ], "widgets_values": [ "blurry, low resolution, worst quality, deformed, bad anatomy, bad quality, lowres" ] }, { "id": 5, "type": "VAEDecode", "pos": [689, 281], "size": [220, 46], "flags": {}, "order": 5, "mode": 0, "inputs": [ { "name": "samples", "type": "LATENT", "link": 10 }, { "name": "vae", "type": "VAE", "link": 4 } ] } ], "links": [ [1, 7, 1, 8, 0, "CLIP"], [2, 7, 1, 9, 0, "CLIP"], [4, 7, 3, 5, 1, "VAE"], [5, 5, 0, 6, 0, "IMAGE"], [6, 7, 0, 3, 0, "MODEL"], [7, 8, 0, 3, 1, "CONDITIONING"], [8, 9, 0, 3, 2, "CONDITIONING"], [9, 4, 0, 3, 3, "LATENT"], [10, 3, 0, 5, 0, "LATENT"] ], "groups": [], "config": {}, "extra": { "ds": "Lw==", "ds_ver": "1.33.10" }, "version": 1.33} ' > default_workflow.json
# 5E. AJOUT : Workflow 2 - SD 1.5 Classique (utilise v1-5-pruned-emaonly.safetensors)
RUN echo '{ "last_node_id": 9, "last_link_id": 10, "nodes": [ { "id": 3, "type": "KSampler", "pos": [311, 281], "size": [337.89, 226.24], "flags": {}, "order": 4, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 6 }, { "name": "positive", "type": "CONDITIONING", "link": 7 }, { "name": "negative", "type": "CONDITIONING", "link": 8 }, { "name": "latent_image", "type": "LATENT", "link": 9 } ] }, { "id": 4, "type": "EmptyLatentImage", "pos": [38, 513], "size": [235.84, 105.85], "flags": {}, "order": 3, "mode": 0, "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [9], "shape": 3 } ] }, { "id": 6, "type": "SaveImage", "pos": [1021, 281], "size": [220, 50], "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 5 } ], "widgets_values": [ "ComfyUI" ] }, { "id": 7, "type": "CheckpointLoaderSimple", "pos": [38, 281], "size": [291.6, 98], "flags": {}, "order": 0, "mode": 0, "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [6], "shape": 3 }, { "name": "CLIP", "type": "CLIP", "links": [1, 2], "shape": 3 }, { "name": "VAE", "type": "VAE", "links": [4], "shape": 3 } ], "widgets_values": [ "v1-5-pruned-emaonly.safetensors" ] }, { "id": 8, "type": "CLIPTextEncode", "pos": [38, 0], "size": [337.89, 150.11], "flags": {}, "order": 1, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 1 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [7], "shape": 3 } ], "widgets_values": [ "a photograph of an astronaut riding a horse, cinematic, epic" ] }, { "id": 9, "type": "CLIPTextEncode", "pos": [38, 175], "size": [337.89, 150.11], "flags": {}, "order": 2, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 2 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [8], "shape": 3 } ], "widgets_values": [ "blurry, low resolution, worst quality, deformed, bad anatomy, bad quality, lowres" ] }, { "id": 5, "type": "VAEDecode", "pos": [689, 281], "size": [220, 46], "flags": {}, "order": 5, "mode": 0, "inputs": [ { "name": "samples", "type": "LATENT", "link": 10 }, { "name": "vae", "type": "VAE", "link": 4 } ] } ], "links": [ [1, 7, 1, 8, 0, "CLIP"], [2, 7, 1, 9, 0, "CLIP"], [4, 7, 3, 5, 1, "VAE"], [5, 5, 0, 6, 0, "IMAGE"], [6, 7, 0, 3, 0, "MODEL"], [7, 8, 0, 3, 1, "CONDITIONING"], [8, 9, 0, 3, 2, "CONDITIONING"], [9, 4, 0, 3, 3, "LATENT"], [10, 3, 0, 5, 0, "LATENT"] ], "groups": [], "config": {}, "extra": { "ds": "Lw==", "ds_ver": "1.33.10" }, "version": 1.33} ' > workflow_sd15_classic.json
# 6. Configuration Hugging Face Space (Port 7860 Obligatoire)
ENV PORT 7860
EXPOSE 7860
# 7. Lancement (CRITIQUE : PORT 7860 et mode --cpu)
CMD ["python3", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--cpu"] |