diff --git a/.runpod/hub.json b/.runpod/hub.json index bc8d1981..f8f42494 100644 --- a/.runpod/hub.json +++ b/.runpod/hub.json @@ -6,7 +6,7 @@ "iconUrl": "https://cpjrphpz3t5wbwfe.public.blob.vercel-storage.com/comfy-ui.png", "config": { "runsOn": "GPU", - "containerDiskInGb": 20, + "containerDiskInGb": 40, "gpuIds": "ADA_24", "gpuCount": 1, "allowedCudaVersions": ["12.8", "12.9", "13.0", "13.1", "13.2"], diff --git a/.runpod/tests.json b/.runpod/tests.json index 9a3769b9..d0a1e410 100644 --- a/.runpod/tests.json +++ b/.runpod/tests.json @@ -3,62 +3,34 @@ { "name": "basic_test", "input": { - "images": [ - { - "name": "test.png", - "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAMklEQVR4nGI5ZdXAQEvARFPTRy0YtWDUglELRi0YtWDUglELRi0YtWDUAioCQAAAAP//E24Bx3jUKuYAAAAASUVORK5CYII=" - } - ], "workflow": { "6": { "inputs": { "text": "anime cat with massive fluffy fennec ears and a big fluffy tail blonde messy long hair blue eyes wearing a construction outfit placing a fancy black forest cake with candles on top of a dinner table of an old dark Victorian mansion lit by candlelight with a bright window to the foggy forest and very expensive stuff everywhere there are paintings on the walls", - "clip": ["30", 1] + "clip": ["60", 0] }, "class_type": "CLIPTextEncode", - "_meta": { - "title": "CLIP Text Encode (Positive Prompt)" - } + "_meta": { "title": "CLIP Text Encode (Positive Prompt)" } }, "8": { - "inputs": { - "samples": ["31", 0], - "vae": ["30", 2] - }, + "inputs": { "samples": ["31", 0], "vae": ["30", 2] }, "class_type": "VAEDecode", - "_meta": { - "title": "VAE Decode" - } + "_meta": { "title": "VAE Decode" } }, "9": { - "inputs": { - "filename_prefix": "ComfyUI", - "images": ["8", 0] - }, + "inputs": { "filename_prefix": "ComfyUI", "images": ["8", 0] }, "class_type": "SaveImage", - "_meta": { - "title": "Save Image" - } + "_meta": { "title": "Save Image" } }, "27": { - "inputs": { - "width": 512, - "height": 512, - "batch_size": 1 - }, + "inputs": { "width": 512, "height": 512, "batch_size": 1 }, "class_type": "EmptySD3LatentImage", - "_meta": { - "title": "EmptySD3LatentImage" - } + "_meta": { "title": "EmptySD3LatentImage" } }, "30": { - "inputs": { - "ckpt_name": "flux1-dev-fp8.safetensors" - }, + "inputs": { "ckpt_name": "fluxedUp.safetensors" }, "class_type": "CheckpointLoaderSimple", - "_meta": { - "title": "Load Checkpoint" - } + "_meta": { "title": "Load Checkpoint" } }, "31": { "inputs": { @@ -74,48 +46,26 @@ "latent_image": ["27", 0] }, "class_type": "KSampler", - "_meta": { - "title": "KSampler" - } + "_meta": { "title": "KSampler" } }, "33": { - "inputs": { - "text": "", - "clip": ["30", 1] - }, + "inputs": { "text": "", "clip": ["60", 0] }, "class_type": "CLIPTextEncode", - "_meta": { - "title": "CLIP Text Encode (Negative Prompt)" - } + "_meta": { "title": "CLIP Text Encode (Negative Prompt)" } }, "35": { - "inputs": { - "guidance": 3.5, - "conditioning": ["6", 0] - }, + "inputs": { "guidance": 3.5, "conditioning": ["6", 0] }, "class_type": "FluxGuidance", - "_meta": { - "title": "FluxGuidance" - } + "_meta": { "title": "FluxGuidance" } }, - "38": { + "60": { "inputs": { - "images": ["8", 0] + "clip_name1": "t5xxl_fp8_e4m3fn.safetensors", + "clip_name2": "clip_l.safetensors", + "type": "flux" }, - "class_type": "PreviewImage", - "_meta": { - "title": "Preview Image" - } - }, - "40": { - "inputs": { - "filename_prefix": "ComfyUI", - "images": ["8", 0] - }, - "class_type": "SaveImage", - "_meta": { - "title": "Save Image" - } + "class_type": "DualCLIPLoader", + "_meta": { "title": "DualCLIPLoader" } } } }, @@ -126,10 +76,7 @@ "gpuTypeId": "NVIDIA GeForce RTX 4090", "gpuCount": 1, "env": [ - { - "key": "REFRESH_WORKER", - "value": "false" - } + { "key": "REFRESH_WORKER", "value": "false" } ], "allowedCudaVersions": ["12.8", "12.9", "13.0"] } diff --git a/Dockerfile b/Dockerfile index 1dd71a95..b7ba4ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -135,7 +135,7 @@ FROM base AS downloader ARG HUGGINGFACE_ACCESS_TOKEN # Set default model type if none is provided -ARG MODEL_TYPE=flux1-dev-fp8 +ARG MODEL_TYPE=fluxed-up # Change working directory to ComfyUI WORKDIR /comfyui @@ -179,8 +179,14 @@ RUN if [ "$MODEL_TYPE" = "z-image-turbo" ]; then \ wget -q --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/model_patches/Z-Image-Turbo-Fun-Controlnet-Union.safetensors https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union/resolve/main/Z-Image-Turbo-Fun-Controlnet-Union.safetensors; \ fi +RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ + wget -O models/checkpoints/fluxedUp.safetensors "https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors" && \ + wget -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \ + wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors; \ + fi + # Stage 3: Final image FROM base AS final # Copy models from stage 2 to the final image -COPY --from=downloader /comfyui/models /comfyui/models \ No newline at end of file +COPY --from=downloader /comfyui/models /comfyui/models diff --git a/handler.py b/handler.py index 817cad8a..883c75f2 100644 --- a/handler.py +++ b/handler.py @@ -20,6 +20,14 @@ run_network_volume_diagnostics, ) +import builtins + +VERBOSE = os.environ.get("WORKER_VERBOSE", "false").lower() == "true" + +def print(*args, **kwargs): + if VERBOSE: + builtins.print(*args, **kwargs) + # --------------------------------------------------------------------------- # Logging setup # --------------------------------------------------------------------------- @@ -438,10 +446,9 @@ def queue_workflow(workflow, client_id, comfy_org_api_key=None): # Handle validation errors with detailed information if response.status_code == 400: - print(f"worker-comfyui - ComfyUI returned 400. Response body: {response.text}") + print(f"worker-comfyui - ComfyUI returned 400 ({len(response.text)} bytes)") try: error_data = response.json() - print(f"worker-comfyui - Parsed error data: {error_data}") # Try to extract meaningful error information error_message = "Workflow validation failed"