From 3a5a7e07cc353dc38a649b4b65304442145ab430 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:47:49 -0500 Subject: [PATCH 01/49] Add base64 encoding for MP4 video output Added a function to encode the final MP4 video as base64 for RunPod endpoint return. --- generate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/generate.py b/generate.py index 3a5cbcdd..7780d313 100644 --- a/generate.py +++ b/generate.py @@ -568,6 +568,30 @@ def generate(args): dist.destroy_process_group() logging.info("Finished.") +# --- Added for RunPod serverless return --- +import os, base64, json + +def export_video_to_base64(): + """Encode the final MP4 video as base64 for RunPod endpoint return.""" + # Locate the video file + output_path = args.save_file if hasattr(args, "save_file") else "/workspace/output/video.mp4" + if not output_path.endswith(".mp4"): + output_path = f"{output_path}.mp4" + + os.makedirs(os.path.dirname(output_path), exist_ok=True) + + if os.path.exists(output_path): + with open(output_path, "rb") as f: + encoded = base64.b64encode(f.read()).decode("utf-8") + print(json.dumps({"video_base64": encoded})) + else: + print(f"⚠️ Video not found at {output_path}") + +try: + export_video_to_base64() +except Exception as e: + print("⚠️ Error returning MP4:", e) +# --- End of patch --- if __name__ == "__main__": From c7880c6c52d6d23fd1a7dcfe734d6b5426ea4c70 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:00:00 -0500 Subject: [PATCH 02/49] Add custom RunPod endpoint configuration for Wan2.2 This file defines a custom RunPod endpoint for Wan2.2, specifying its properties and configuration. --- .runpod/hub.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .runpod/hub.json diff --git a/.runpod/hub.json b/.runpod/hub.json new file mode 100644 index 00000000..f54e850d --- /dev/null +++ b/.runpod/hub.json @@ -0,0 +1,19 @@ +{ + "title": "Wan2.2 Patched Return", + "description": "Custom RunPod endpoint for Wan2.2 with MP4 Base64 return output.", + "type": "serverless", + "category": "video", + "iconUrl": "https://cdn-icons-png.flaticon.com/512/2921/2921222.png", + "config": { + "runsOn": "GPU", + "containerDiskInGb": 40, + "presets": [ + { + "id": "default", + "gpu": "A10G", + "memoryInGb": 24, + "cpus": 8 + } + ] + } +} From 324636deb995642c191047a93bdeb8dbd142547b Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:04:41 -0500 Subject: [PATCH 03/49] Add tests.json for basic video test configuration --- .runpod/tests.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .runpod/tests.json diff --git a/.runpod/tests.json b/.runpod/tests.json new file mode 100644 index 00000000..c8ae4949 --- /dev/null +++ b/.runpod/tests.json @@ -0,0 +1,13 @@ +{ + "tests": [ + { + "name": "basic_video_test", + "input": { + "prompt": "A cinematic scene of ocean waves at sunset", + "seed": 42, + "num_frames": 12 + }, + "timeout": 120000 + } + ] +} From 1207a11d9a821fb827a14a4272c8388c579f2470 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:12:46 -0500 Subject: [PATCH 04/49] Add Dockerfile for project setup and dependencies --- wan/Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 wan/Dockerfile diff --git a/wan/Dockerfile b/wan/Dockerfile new file mode 100644 index 00000000..a7281b4d --- /dev/null +++ b/wan/Dockerfile @@ -0,0 +1,16 @@ +# --- Base image --- +FROM runpod/base:0.4.0-cuda12.1.1 + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- +RUN pip install --upgrade pip && \ + pip install -r requirements.txt && \ + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 + +# --- Default command --- +CMD ["python3", "-u", "handler.py"] From e1676efa521d8982e0f17bd111e52d6aebd1cf02 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:16:19 -0500 Subject: [PATCH 05/49] Rename wan/Dockerfile to Dockerfile --- wan/Dockerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename wan/Dockerfile => Dockerfile (100%) diff --git a/wan/Dockerfile b/Dockerfile similarity index 100% rename from wan/Dockerfile rename to Dockerfile From 4b0529019d4a47dfdadd8999c86202383a620ec0 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:18:27 -0500 Subject: [PATCH 06/49] Implement handler function for video processing --- handler.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 handler.py diff --git a/handler.py b/handler.py new file mode 100644 index 00000000..42a74412 --- /dev/null +++ b/handler.py @@ -0,0 +1,35 @@ +import os, json, base64, subprocess + +def handler(event): + try: + # Get input prompt from the RunPod payload + input_data = event.get("input", {}) + prompt = input_data.get("prompt", "Default prompt") + print(f"[RunPod] Received prompt: {prompt}") + + # Run your generate.py script + result = subprocess.run( + ["python3", "generate.py"], + capture_output=True, + text=True + ) + + # Check for saved MP4 + output_path = "/workspace/output/video.mp4" + if os.path.exists(output_path): + with open(output_path, "rb") as f: + encoded = base64.b64encode(f.read()).decode("utf-8") + return {"video_base64": encoded} + + return { + "error": "⚠️ Video not found at /workspace/output/video.mp4", + "stdout": result.stdout, + "stderr": result.stderr + } + + except Exception as e: + return {"error": str(e)} + +if __name__ == "__main__": + test = {"input": {"prompt": "A cinematic test render"}} + print(json.dumps(handler(test))) From 7d73a160dfab4931c21430326956754c3ad142c4 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:20:10 -0500 Subject: [PATCH 07/49] Fix video encoding return statement in handler.py --- handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handler.py b/handler.py index 42a74412..0237fb6d 100644 --- a/handler.py +++ b/handler.py @@ -19,7 +19,8 @@ def handler(event): if os.path.exists(output_path): with open(output_path, "rb") as f: encoded = base64.b64encode(f.read()).decode("utf-8") - return {"video_base64": encoded} + encoded = base64.b64encode(f.read()).decode("utf-8") + return { "error": "⚠️ Video not found at /workspace/output/video.mp4", From 290fbc6eeb442763da4681347217f5e24fe208f6 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:23:55 -0500 Subject: [PATCH 08/49] Update handler.py --- handler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/handler.py b/handler.py index 0237fb6d..2320d219 100644 --- a/handler.py +++ b/handler.py @@ -18,7 +18,6 @@ def handler(event): output_path = "/workspace/output/video.mp4" if os.path.exists(output_path): with open(output_path, "rb") as f: - encoded = base64.b64encode(f.read()).decode("utf-8") encoded = base64.b64encode(f.read()).decode("utf-8") From 121942a04c02df2117fefa2e99e859a630dcfc4e Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:43:02 -0500 Subject: [PATCH 09/49] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7281b4d..ba3a91ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # --- Base image --- -FROM runpod/base:0.4.0-cuda12.1.1 +FROM runpod/pytorch:3.10-2.1.0 # --- Working directory --- WORKDIR /workspace From f7f0f0264a5f6219b3a362d7b9babaef4ae58b3d Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:59:07 -0500 Subject: [PATCH 10/49] Install PyTorch and related packages in Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ba3a91ba..a07629e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # --- Base image --- -FROM runpod/pytorch:3.10-2.1.0 +RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 + # --- Working directory --- WORKDIR /workspace From 06e4e11be571780edb1cb49e11027adfac4b6a07 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:16:19 -0500 Subject: [PATCH 11/49] Change base image to nvidia/cuda:12.1.1-base-ubuntu22.04 --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a07629e4..486cdf05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # --- Base image --- -RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + # --- Working directory --- From 6b392ada8a7493abdaed5b302a08b526981394e6 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:40:54 -0500 Subject: [PATCH 12/49] Install Python and dependencies in Dockerfile Added installation of Python and system dependencies. --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 486cdf05..15ba322f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,10 @@ # --- Base image --- FROM nvidia/cuda:12.1.1-base-ubuntu22.04 - +# --- Install Python and system dependencies --- +RUN apt-get update && \ + apt-get install -y python3 python3-pip git && \ + rm -rf /var/lib/apt/lists/* # --- Working directory --- WORKDIR /workspace @@ -16,3 +19,4 @@ RUN pip install --upgrade pip && \ # --- Default command --- CMD ["python3", "-u", "handler.py"] + From 1401539efdd063d5431412947f0185b6f699cfae Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:20:01 -0500 Subject: [PATCH 13/49] Update Dockerfile --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 15ba322f..61ca210a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,11 @@ WORKDIR /workspace COPY . . # --- Install Python dependencies --- -RUN pip install --upgrade pip && \ - pip install -r requirements.txt && \ - pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +RUN pip install --upgrade pip \ + && pip install torch==2.9.0 torchvision==0.24.0 torchaudio==2.9.0 \ + --index-url https://download.pytorch.org/whl/cu121 \ + && pip install -r requirements.txt + # --- Default command --- CMD ["python3", "-u", "handler.py"] From d06dd689af5b5463ee1d4313ebcb847c8049f3e9 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:38:59 -0500 Subject: [PATCH 14/49] Update PyTorch and related package versions --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61ca210a..b3a0d0c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,15 @@ COPY . . # --- Install Python dependencies --- RUN pip install --upgrade pip \ - && pip install torch==2.9.0 torchvision==0.24.0 torchaudio==2.9.0 \ - --index-url https://download.pytorch.org/whl/cu121 \ + && pip install \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 \ + --index-url https://download.pytorch.org/whl/cu121 \ && pip install -r requirements.txt + # --- Default command --- CMD ["python3", "-u", "handler.py"] From e1489454ed16393b026a1330a775189b312fd83d Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:55:52 -0500 Subject: [PATCH 15/49] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index b3a0d0c3..e7ee5784 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,10 +19,12 @@ RUN pip install --upgrade pip \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 \ --index-url https://download.pytorch.org/whl/cu121 \ + && pip install --no-build-isolation flash-attn==2.8.3 \ && pip install -r requirements.txt + # --- Default command --- CMD ["python3", "-u", "handler.py"] From f27639a8196ce7dc7ecbdc8c26617e9fd134dff4 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:10:38 -0500 Subject: [PATCH 16/49] Add packaging and update PyTorch dependencies in Dockerfile Updated pip installation to include packaging and specific versions of PyTorch, torchvision, and torchaudio. --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index e7ee5784..6d794e4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ COPY . . # --- Install Python dependencies --- RUN pip install --upgrade pip \ + && pip install packaging \ && pip install \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ @@ -25,6 +26,7 @@ RUN pip install --upgrade pip \ + # --- Default command --- CMD ["python3", "-u", "handler.py"] From d9ef11e1177206ea786d793ad67ace44f61b211f Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:57:34 -0500 Subject: [PATCH 17/49] Update Dockerfile to use python3 for pip installs --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6d794e4b..baca5c6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,14 +14,15 @@ COPY . . # --- Install Python dependencies --- RUN pip install --upgrade pip \ - && pip install packaging \ - && pip install \ + && python3 -m pip install --no-cache-dir packaging setuptools wheel \ + && python3 -m pip install --no-cache-dir \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 \ --index-url https://download.pytorch.org/whl/cu121 \ - && pip install --no-build-isolation flash-attn==2.8.3 \ - && pip install -r requirements.txt + && python3 -m pip install --no-build-isolation --no-cache-dir flash-attn==2.8.3 \ + && python3 -m pip install --no-cache-dir -r requirements.txt + From adb6f8db28345ffb5ff9fad9fdd5322ebf40140a Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:17:04 -0500 Subject: [PATCH 18/49] Install git in Dockerfile Added git installation to Dockerfile for version control. --- Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index baca5c6f..b44efd9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM nvidia/cuda:12.1.1-base-ubuntu22.04 # --- Install Python and system dependencies --- +# 👇 This section is key — note the addition of git RUN apt-get update && \ apt-get install -y python3 python3-pip git && \ rm -rf /var/lib/apt/lists/* @@ -20,14 +21,10 @@ RUN pip install --upgrade pip \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 \ --index-url https://download.pytorch.org/whl/cu121 \ - && python3 -m pip install --no-build-isolation --no-cache-dir flash-attn==2.8.3 \ + && python3 -m pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3 \ + || (echo "⚠️ flash-attn skipped; attention optimizations disabled" && true) \ && python3 -m pip install --no-cache-dir -r requirements.txt - - - - - # --- Default command --- CMD ["python3", "-u", "handler.py"] From 73cf9b04376d5f6379c7040b6ebe284b30531bdd Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:24:24 -0500 Subject: [PATCH 19/49] Update Dockerfile to include additional Python packages --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b44efd9a..80d9c677 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,17 +14,18 @@ WORKDIR /workspace COPY . . # --- Install Python dependencies --- -RUN pip install --upgrade pip \ - && python3 -m pip install --no-cache-dir packaging setuptools wheel \ +RUN python3 -m pip install --upgrade pip \ + && python3 -m pip install --no-cache-dir packaging setuptools wheel pybind11 cmake ninja \ && python3 -m pip install --no-cache-dir \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 \ --index-url https://download.pytorch.org/whl/cu121 \ - && python3 -m pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3 \ - || (echo "⚠️ flash-attn skipped; attention optimizations disabled" && true) \ + && (python3 -m pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3 \ + || (echo "⚠️ flash-attn skipped; attention optimizations disabled" && true)) \ && python3 -m pip install --no-cache-dir -r requirements.txt + # --- Default command --- CMD ["python3", "-u", "handler.py"] From a168931c9be6f46f064449d452445ec945d72e71 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:49:40 -0500 Subject: [PATCH 20/49] Refactor Dockerfile for clarity and organization --- Dockerfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 80d9c677..924a0207 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,15 @@ # --- Base image --- FROM nvidia/cuda:12.1.1-base-ubuntu22.04 -# --- Install Python and system dependencies --- -# 👇 This section is key — note the addition of git +# --- System + Python dependencies --- RUN apt-get update && \ apt-get install -y python3 python3-pip git && \ rm -rf /var/lib/apt/lists/* -# --- Working directory --- WORKDIR /workspace - -# --- Copy project files --- COPY . . -# --- Install Python dependencies --- +# --- Install Python packages --- RUN python3 -m pip install --upgrade pip \ && python3 -m pip install --no-cache-dir packaging setuptools wheel pybind11 cmake ninja \ && python3 -m pip install --no-cache-dir \ @@ -22,10 +18,10 @@ RUN python3 -m pip install --upgrade pip \ torchaudio==2.5.1+cu121 \ --index-url https://download.pytorch.org/whl/cu121 \ && (python3 -m pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3 \ - || (echo "⚠️ flash-attn skipped; attention optimizations disabled" && true)) \ + || echo "⚠️ flash-attn skipped; attention optimizations disabled") \ && python3 -m pip install --no-cache-dir -r requirements.txt +CMD ["python3", "-u", "handler.py"] -# --- Default command --- CMD ["python3", "-u", "handler.py"] From d6c9507aa47bf60110f06af21fe88319749c021a Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:54:18 -0500 Subject: [PATCH 21/49] Update Dockerfile --- Dockerfile | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 924a0207..939eeba0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,23 @@ -# --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 - -# --- System + Python dependencies --- -RUN apt-get update && \ - apt-get install -y python3 python3-pip git && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /workspace -COPY . . - -# --- Install Python packages --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_BUILD_ISOLATION=1 +ARG INSTALL_FLASH_ATTN=false RUN python3 -m pip install --upgrade pip \ && python3 -m pip install --no-cache-dir packaging setuptools wheel pybind11 cmake ninja \ - && python3 -m pip install --no-cache-dir \ + && python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 \ - --index-url https://download.pytorch.org/whl/cu121 \ - && (python3 -m pip install --no-cache-dir --no-build-isolation flash-attn==2.8.3 \ - || echo "⚠️ flash-attn skipped; attention optimizations disabled") \ + && python3 -c "import torch; print('Torch', torch.__version__, 'available.')" \ + && if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + if python3 -m pip install --no-cache-dir --no-build-isolation --no-deps flash-attn==2.8.3; then \ + echo "flash-attn installed"; \ + else \ + echo "⚠️ flash-attn install failed; attention optimizations disabled"; \ + fi; \ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi \ && python3 -m pip install --no-cache-dir -r requirements.txt -CMD ["python3", "-u", "handler.py"] - -CMD ["python3", "-u", "handler.py"] From 75ba46b83cadbe0debc139c6de8ed6fdcc9067a9 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:10:04 -0500 Subject: [PATCH 22/49] Update Dockerfile --- Dockerfile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 939eeba0..990fcc42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,18 @@ +# --- Base image --- +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + +# --- Install Python and system dependencies --- +RUN apt-get update && \ + apt-get install -y python3 python3-pip git && \ + rm -rf /var/lib/apt/lists/* + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_BUILD_ISOLATION=1 ARG INSTALL_FLASH_ATTN=false @@ -20,4 +35,4 @@ RUN python3 -m pip install --upgrade pip \ fi \ && python3 -m pip install --no-cache-dir -r requirements.txt - +# --- Default command --- From bb985cdb39bdb153c4e2c0ee4f0fbd13d34dd34e Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:36:33 -0500 Subject: [PATCH 23/49] Add default command to run handler.py --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 990fcc42..c9261707 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,3 +36,4 @@ RUN python3 -m pip install --upgrade pip \ && python3 -m pip install --no-cache-dir -r requirements.txt # --- Default command --- +CMD ["python3", "-u", "handler.py"] From f30a2d6f84a2de78fe4c98138aabad3ff20d4fcf Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:41:18 -0500 Subject: [PATCH 24/49] Update Dockerfile --- Dockerfile | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index c9261707..5e6acb38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,28 +12,37 @@ WORKDIR /workspace # --- Copy project files --- COPY . . -# --- Install Python dependencies --- +# --- Set environment variables --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_BUILD_ISOLATION=1 + PIP_NO_BUILD_ISOLATION=1 \ + CUDA_HOME=/usr/local/cuda \ + PATH=/usr/local/cuda/bin:$PATH + +# --- Install PyTorch first --- +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install --no-cache-dir packaging setuptools wheel && \ + python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" + +# --- Install build tools and flash-attention --- ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip \ - && python3 -m pip install --no-cache-dir packaging setuptools wheel pybind11 cmake ninja \ - && python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 \ - && python3 -c "import torch; print('Torch', torch.__version__, 'available.')" \ - && if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ +RUN python3 -m pip install --no-cache-dir pybind11 cmake ninja && \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ echo "Attempting flash-attn install"; \ - if python3 -m pip install --no-cache-dir --no-build-isolation --no-deps flash-attn==2.8.3; then \ + if python3 -m pip install --no-cache-dir flash-attn==2.8.3; then \ echo "flash-attn installed"; \ else \ echo "⚠️ flash-attn install failed; attention optimizations disabled"; \ fi; \ else \ echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi \ - && python3 -m pip install --no-cache-dir -r requirements.txt + fi + +# --- Install remaining requirements --- +RUN python3 -m pip install --no-cache-dir -r requirements.txt # --- Default command --- CMD ["python3", "-u", "handler.py"] From 4160fa4af217530b743d97422c269db1fe71c9a7 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:56:18 -0500 Subject: [PATCH 25/49] Update Dockerfile to install additional dependencies --- Dockerfile | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5e6acb38..9222b052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,14 @@ FROM nvidia/cuda:12.1.1-base-ubuntu22.04 # --- Install Python and system dependencies --- RUN apt-get update && \ - apt-get install -y python3 python3-pip git && \ - rm -rf /var/lib/apt/lists/* + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + python3 \ + python3-pip \ + git \ + curl \ + wget \ + build-essential \ + && rm -rf /var/lib/apt/lists/* # --- Working directory --- WORKDIR /workspace @@ -18,19 +24,28 @@ ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ CUDA_HOME=/usr/local/cuda \ PATH=/usr/local/cuda/bin:$PATH -# --- Install PyTorch first --- +# --- Install Python dependencies --- +ARG INSTALL_FLASH_ATTN=false + +# Install base Python packages RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install --no-cache-dir packaging setuptools wheel && \ - python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + python3 -m pip install --no-cache-dir \ + packaging \ + setuptools \ + wheel \ + pybind11 \ + cmake \ + ninja + +# Install PyTorch +RUN python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ python3 -c "import torch; print('Torch', torch.__version__, 'available.')" -# --- Install build tools and flash-attention --- -ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --no-cache-dir pybind11 cmake ninja && \ - if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ +# Install flash-attention if enabled +RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ echo "Attempting flash-attn install"; \ if python3 -m pip install --no-cache-dir flash-attn==2.8.3; then \ echo "flash-attn installed"; \ @@ -41,7 +56,7 @@ RUN python3 -m pip install --no-cache-dir pybind11 cmake ninja && \ echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ fi -# --- Install remaining requirements --- +# Install remaining requirements RUN python3 -m pip install --no-cache-dir -r requirements.txt # --- Default command --- From cc935674d07fa7cd7470165dc78d35572b7cbfd2 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:09:22 -0500 Subject: [PATCH 26/49] Update Dockerfile --- Dockerfile | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9222b052..55f42672 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,6 @@ RUN apt-get update && \ python3 \ python3-pip \ git \ - curl \ - wget \ build-essential \ && rm -rf /var/lib/apt/lists/* @@ -22,12 +20,11 @@ COPY . . ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_BUILD_ISOLATION=1 \ CUDA_HOME=/usr/local/cuda \ - PATH=/usr/local/cuda/bin:$PATH + PATH=/usr/local/cuda/bin:$PATH \ + TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" -# --- Install Python dependencies --- -ARG INSTALL_FLASH_ATTN=false - -# Install base Python packages +# --- Install dependencies in stages --- +# Stage 1: Basic Python tools RUN python3 -m pip install --upgrade pip && \ python3 -m pip install --no-cache-dir \ packaging \ @@ -37,26 +34,23 @@ RUN python3 -m pip install --upgrade pip && \ cmake \ ninja -# Install PyTorch +# Stage 2: PyTorch installation RUN python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ python3 -c "import torch; print('Torch', torch.__version__, 'available.')" -# Install flash-attention if enabled +# Stage 3: Flash Attention (if enabled) +ARG INSTALL_FLASH_ATTN=false RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - if python3 -m pip install --no-cache-dir flash-attn==2.8.3; then \ - echo "flash-attn installed"; \ - else \ - echo "⚠️ flash-attn install failed; attention optimizations disabled"; \ - fi; \ + echo "Attempting flash-attn install" && \ + python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ else \ echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ fi -# Install remaining requirements +# Stage 4: Project requirements RUN python3 -m pip install --no-cache-dir -r requirements.txt # --- Default command --- From db5c04290f867231e2984f739dde1fa5d9197867 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:25:38 -0500 Subject: [PATCH 27/49] Refactor Dockerfile for better dependency management Updated Dockerfile to improve dependency installation and structure. --- Dockerfile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55f42672..7c7de14b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3 \ python3-pip \ + python3-dev \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* @@ -13,15 +14,14 @@ RUN apt-get update && \ # --- Working directory --- WORKDIR /workspace -# --- Copy project files --- -COPY . . - # --- Set environment variables --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_BUILD_ISOLATION=1 \ CUDA_HOME=/usr/local/cuda \ PATH=/usr/local/cuda/bin:$PATH \ - TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" + FORCE_CUDA=1 + +# --- Copy only requirements first --- +COPY requirements.txt . # --- Install dependencies in stages --- # Stage 1: Basic Python tools @@ -41,17 +41,20 @@ RUN python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_U torchaudio==2.5.1+cu121 && \ python3 -c "import torch; print('Torch', torch.__version__, 'available.')" -# Stage 3: Flash Attention (if enabled) +# Stage 3: Install requirements +RUN python3 -m pip install --no-cache-dir -r requirements.txt + +# Stage 4: Flash Attention (optional) ARG INSTALL_FLASH_ATTN=false RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ echo "Attempting flash-attn install" && \ python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + echo "Skipping flash-attn install"; \ fi -# Stage 4: Project requirements -RUN python3 -m pip install --no-cache-dir -r requirements.txt +# --- Copy remaining project files --- +COPY . . # --- Default command --- CMD ["python3", "-u", "handler.py"] From af298355874f48095f877170066331b274d73293 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:37:15 -0500 Subject: [PATCH 28/49] Update Dockerfile --- Dockerfile | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c7de14b..abc79cb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,20 +11,19 @@ RUN apt-get update && \ build-essential \ && rm -rf /var/lib/apt/lists/* -# --- Working directory --- -WORKDIR /workspace - # --- Set environment variables --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ CUDA_HOME=/usr/local/cuda \ PATH=/usr/local/cuda/bin:$PATH \ FORCE_CUDA=1 -# --- Copy only requirements first --- +# --- Working directory --- +WORKDIR /workspace + +# --- Copy requirements first --- COPY requirements.txt . -# --- Install dependencies in stages --- -# Stage 1: Basic Python tools +# --- Install base dependencies --- RUN python3 -m pip install --upgrade pip && \ python3 -m pip install --no-cache-dir \ packaging \ @@ -34,27 +33,24 @@ RUN python3 -m pip install --upgrade pip && \ cmake \ ninja -# Stage 2: PyTorch installation +# --- Install PyTorch --- RUN python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ python3 -c "import torch; print('Torch', torch.__version__, 'available.')" -# Stage 3: Install requirements -RUN python3 -m pip install --no-cache-dir -r requirements.txt +# --- Install requirements --- +RUN python3 -m pip install --no-cache-dir --verbose -r requirements.txt -# Stage 4: Flash Attention (optional) +# --- Copy remaining project files --- +COPY . . + +# --- Install Flash Attention (optional) --- ARG INSTALL_FLASH_ATTN=false RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install" && \ python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ - else \ - echo "Skipping flash-attn install"; \ fi -# --- Copy remaining project files --- -COPY . . - # --- Default command --- CMD ["python3", "-u", "handler.py"] From 68b24d272782a1bfa64ce9b320f21e8130f01714 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:46:06 -0500 Subject: [PATCH 29/49] Enhance Dockerfile with CUDA and PyTorch updates Updated Dockerfile to include CUDA toolkit and set architecture list. Modified installation stages for PyTorch and project requirements. --- Dockerfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index abc79cb9..8787328f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,13 +9,15 @@ RUN apt-get update && \ python3-dev \ git \ build-essential \ + cuda-toolkit-12-1 \ && rm -rf /var/lib/apt/lists/* # --- Set environment variables --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ CUDA_HOME=/usr/local/cuda \ PATH=/usr/local/cuda/bin:$PATH \ - FORCE_CUDA=1 + FORCE_CUDA=1 \ + TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" # --- Working directory --- WORKDIR /workspace @@ -23,25 +25,25 @@ WORKDIR /workspace # --- Copy requirements first --- COPY requirements.txt . -# --- Install base dependencies --- +# --- Install PyTorch and dependencies in stages --- RUN python3 -m pip install --upgrade pip && \ + # Stage 1: Install build tools python3 -m pip install --no-cache-dir \ packaging \ setuptools \ wheel \ pybind11 \ cmake \ - ninja - -# --- Install PyTorch --- -RUN python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + ninja && \ + # Stage 2: Install PyTorch + python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" + python3 -c "import torch; assert torch.cuda.is_available(), 'CUDA not available'" -# --- Install requirements --- -RUN python3 -m pip install --no-cache-dir --verbose -r requirements.txt +# --- Install project requirements --- +RUN pip install --no-cache-dir -r requirements.txt # --- Copy remaining project files --- COPY . . From f5b7e9d5399851e4ce44812acca8802888ad9f64 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:05:42 -0500 Subject: [PATCH 30/49] Update Dockerfile for CUDA and dependency installation --- Dockerfile | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8787328f..418f4a03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,33 @@ -# --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 +# Use NVIDIA CUDA runtime image +FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04 -# --- Install Python and system dependencies --- -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive \ + TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + CUDA_HOME=/usr/local/cuda \ + PATH=/usr/local/cuda/bin:$PATH \ + LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH + +# Install system dependencies +RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ python3-dev \ git \ build-essential \ cuda-toolkit-12-1 \ + cuda-libraries-dev-12-1 \ && rm -rf /var/lib/apt/lists/* -# --- Set environment variables --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - CUDA_HOME=/usr/local/cuda \ - PATH=/usr/local/cuda/bin:$PATH \ - FORCE_CUDA=1 \ - TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" - -# --- Working directory --- +# Set working directory WORKDIR /workspace -# --- Copy requirements first --- +# Copy requirements first COPY requirements.txt . -# --- Install PyTorch and dependencies in stages --- +# Install Python dependencies in stages RUN python3 -m pip install --upgrade pip && \ - # Stage 1: Install build tools + # Base tools python3 -m pip install --no-cache-dir \ packaging \ setuptools \ @@ -35,24 +35,19 @@ RUN python3 -m pip install --upgrade pip && \ pybind11 \ cmake \ ninja && \ - # Stage 2: Install PyTorch + # PyTorch with CUDA support python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; assert torch.cuda.is_available(), 'CUDA not available'" + # Verify CUDA availability + python3 -c "import torch; print('CUDA available:', torch.cuda.is_available())" -# --- Install project requirements --- -RUN pip install --no-cache-dir -r requirements.txt +# Install project requirements +RUN python3 -m pip install --no-cache-dir -r requirements.txt -# --- Copy remaining project files --- +# Copy remaining project files COPY . . -# --- Install Flash Attention (optional) --- -ARG INSTALL_FLASH_ATTN=false -RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ - fi - -# --- Default command --- +# Default command CMD ["python3", "-u", "handler.py"] From 875a905ec30ae74fe933ada6a942c84693add78c Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:25:54 -0500 Subject: [PATCH 31/49] Update Dockerfile --- Dockerfile | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 418f4a03..6d02a1e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,30 @@ -# Use NVIDIA CUDA runtime image +# --- Base image --- FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04 -# Set environment variables +# --- Environment variables --- ENV DEBIAN_FRONTEND=noninteractive \ TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ CUDA_HOME=/usr/local/cuda \ PATH=/usr/local/cuda/bin:$PATH \ LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH -# Install system dependencies -RUN apt-get update && apt-get install -y \ +# --- Install system dependencies --- +RUN apt-get update && \ + apt-get install -y \ python3 \ python3-pip \ python3-dev \ git \ build-essential \ - cuda-toolkit-12-1 \ - cuda-libraries-dev-12-1 \ && rm -rf /var/lib/apt/lists/* -# Set working directory +# --- Working directory --- WORKDIR /workspace -# Copy requirements first +# --- Copy requirements first --- COPY requirements.txt . -# Install Python dependencies in stages +# --- Install PyTorch and dependencies --- RUN python3 -m pip install --upgrade pip && \ # Base tools python3 -m pip install --no-cache-dir \ @@ -35,19 +34,25 @@ RUN python3 -m pip install --upgrade pip && \ pybind11 \ cmake \ ninja && \ - # PyTorch with CUDA support + # PyTorch with CUDA python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ torchaudio==2.5.1+cu121 && \ - # Verify CUDA availability - python3 -c "import torch; print('CUDA available:', torch.cuda.is_available())" + # Verify PyTorch installation + python3 -c "import torch; print('PyTorch', torch.__version__)" -# Install project requirements +# --- Install Flash Attention (optional) --- +ARG INSTALL_FLASH_ATTN=false +RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ + fi + +# --- Install remaining requirements --- RUN python3 -m pip install --no-cache-dir -r requirements.txt -# Copy remaining project files +# --- Copy project files --- COPY . . -# Default command +# --- Default command --- CMD ["python3", "-u", "handler.py"] From ee76b0c85457292890570c714de635984f8a0b8b Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:56:41 -0500 Subject: [PATCH 32/49] Update Dockerfile --- Dockerfile | 69 +++++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6d02a1e8..f27a26c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,58 +1,37 @@ # --- Base image --- -FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04 +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 -# --- Environment variables --- -ENV DEBIAN_FRONTEND=noninteractive \ - TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - CUDA_HOME=/usr/local/cuda \ - PATH=/usr/local/cuda/bin:$PATH \ - LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH +# --- Set environment variables for non-interactive installs --- +ENV DEBIAN_FRONTEND=noninteractive # --- Install system dependencies --- -RUN apt-get update && \ - apt-get install -y \ - python3 \ - python3-pip \ - python3-dev \ - git \ - build-essential \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git && rm -rf /var/lib/apt/lists/* # --- Working directory --- WORKDIR /workspace -# --- Copy requirements first --- -COPY requirements.txt . - -# --- Install PyTorch and dependencies --- -RUN python3 -m pip install --upgrade pip && \ - # Base tools - python3 -m pip install --no-cache-dir \ - packaging \ - setuptools \ - wheel \ - pybind11 \ - cmake \ - ninja && \ - # PyTorch with CUDA - python3 -m pip install --no-cache-dir --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \ - # Verify PyTorch installation - python3 -c "import torch; print('PyTorch', torch.__version__)" - -# --- Install Flash Attention (optional) --- -ARG INSTALL_FLASH_ATTN=false -RUN if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - python3 -m pip install --no-cache-dir flash-attn==2.8.3; \ - fi - -# --- Install remaining requirements --- -RUN python3 -m pip install --no-cache-dir -r requirements.txt - # --- Copy project files --- COPY . . +# --- Install Python dependencies --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 +ARG INSTALL_FLASH_ATTN=false +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \ + echo "flash-attn installed"; \ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \ + python3 -m pip install -r requirements.txt + # --- Default command --- CMD ["python3", "-u", "handler.py"] From 609e9a5ff5f265c190a751090d1f3c1b1e6463c8 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:04:35 -0500 Subject: [PATCH 33/49] Add libgl1-mesa-glx to Dockerfile dependencies --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f27a26c9..8e6dfc1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ FROM nvidia/cuda:12.1.1-base-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive # --- Install system dependencies --- -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* # --- Working directory --- WORKDIR /workspace @@ -35,3 +35,4 @@ RUN python3 -m pip install --upgrade pip && \ # --- Default command --- CMD ["python3", "-u", "handler.py"] + From 07e2fc4a04034dc859d351d4bd7fbf736a324164 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:20:47 -0500 Subject: [PATCH 34/49] Add Dockerfile --- Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..57cec33c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# --- Base image --- +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + +# --- Set environment variables for non-interactive installs --- +ENV DEBIAN_FRONTEND=noninteractive + +# --- Install system dependencies --- +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 +ARG INSTALL_FLASH_ATTN=false +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ + if [ "${INSTALL_FLASH_ATTn}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ + echo "flash-attn installed"; \$ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \$ + python3 -m pip install -r requirements.txt + +# --- Default command --- +CMD ["python3", "-u", "handler.py"] \ No newline at end of file From 4cc1b8f90957d83d0b404d2edd0e044df88d3776 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:33:49 -0500 Subject: [PATCH 35/49] Fix: Correct syntax, typos, and line endings in Dockerfile --- Dockerfile | 72 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index 57cec33c..bd49898c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,37 @@ -# --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 - -# --- Set environment variables for non-interactive installs --- -ENV DEBIAN_FRONTEND=noninteractive - -# --- Install system dependencies --- -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* - -# --- Working directory --- -WORKDIR /workspace - -# --- Copy project files --- -COPY . . - -# --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_CACHE_DIR=1 -ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ - if [ "${INSTALL_FLASH_ATTn}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ - echo "flash-attn installed"; \$ - else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi && \$ - python3 -m pip install -r requirements.txt - -# --- Default command --- +# --- Base image --- +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + +# --- Set environment variables for non-interactive installs --- +ENV DEBIAN_FRONTEND=noninteractive + +# --- Install system dependencies --- +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 +ARG INSTALL_FLASH_ATTN=false +RUN python3 -m pip install --upgrade pip && \&& \ \ + python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \&& \ \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \&& \ \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \&& \ \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ + echo "flash-attn installed"; \$ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \$ + python3 -m pip install -r requirements.txt + +# --- Default command --- CMD ["python3", "-u", "handler.py"] \ No newline at end of file From 81d95f6d55b29030dcb32a988ff396eff6415936 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:41:54 -0500 Subject: [PATCH 36/49] Fix: Correct Dockerfile syntax and content --- Dockerfile | 72 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd49898c..00beb103 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,37 @@ -# --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 - -# --- Set environment variables for non-interactive installs --- -ENV DEBIAN_FRONTEND=noninteractive - -# --- Install system dependencies --- -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* - -# --- Working directory --- -WORKDIR /workspace - -# --- Copy project files --- -COPY . . - -# --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_CACHE_DIR=1 -ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip && \&& \ \ - python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \&& \ \ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \&& \ \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \&& \ \ - if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ - echo "flash-attn installed"; \$ - else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi && \$ - python3 -m pip install -r requirements.txt - -# --- Default command --- +# --- Base image --- +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + +# --- Set environment variables for non-interactive installs --- +ENV DEBIAN_FRONTEND=noninteractive + +# --- Install system dependencies --- +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 +ARG INSTALL_FLASH_ATTN=false +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ + echo "flash-attn installed"; \$ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \$ + python3 -m pip install -r requirements.txt + +# --- Default command --- CMD ["python3", "-u", "handler.py"] \ No newline at end of file From 5a0273b1eb7729bdba6cd3fb01450016a6018feb Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:49:59 -0500 Subject: [PATCH 37/49] Fix: Correct Dockerfile syntax and content (for real this time) --- Dockerfile | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00beb103..ee3b353d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,24 +14,17 @@ WORKDIR /workspace COPY . . # --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_CACHE_DIR=1 +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \] + PAP_NO_CACHE_DIR=1 ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install packaging setuptools wheel pybind13 cmake ninja && \ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ - if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \$ - echo "flash-attn installed"; \$ - else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi && \$ - python3 -m pip install -r requirements.txt - -# --- Default command --- -CMD ["python3", "-u", "handler.py"] \ No newline at end of file +RUN python3 -m pip install --upgrade pip && \\ + python3 -m pip install cmake ninja packaging pybind13 setuptools wheel && \\ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \\ + torch==2.5.1+cu121 \\ + torchaudio==2.5.1+cu121 \\ + torchvision==0.20.1+cu121 && \\ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \\ + if [ "${ NSTALL_FLASH_ATTN}" = "true" ]; then \\ + echo "Attempting flash-attn install"; \\ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \\ + echo "flash-attn instaqp4(͔qp4(M͠Ѹх͕Ё%9MQ11}1M!}QQ8ՔѼѕФqp4(qp4(ѡ̀хȁɕեɕ̹4(4(ձЁ4) 5lѡ̈Ԉȹt \ No newline at end of file From 8240800cf9bc39eaf7e705806ec84a103eb27043 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:59:39 -0500 Subject: [PATCH 38/49] Update Dockerfile --- Dockerfile | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee3b353d..fff62f70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,17 +14,24 @@ WORKDIR /workspace COPY . . # --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \] - PAP_NO_CACHE_DIR=1 +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip && \\ - python3 -m pip install cmake ninja packaging pybind13 setuptools wheel && \\ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \\ - torch==2.5.1+cu121 \\ - torchaudio==2.5.1+cu121 \\ - torchvision==0.20.1+cu121 && \\ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \\ - if [ "${ NSTALL_FLASH_ATTN}" = "true" ]; then \\ - echo "Attempting flash-attn install"; \\ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \\ - echo "flash-attn instaqp4(͔qp4(M͠Ѹх͕Ё%9MQ11}1M!}QQ8ՔѼѕФqp4(qp4(ѡ̀хȁɕեɕ̹4(4(ձЁ4) 5lѡ̈Ԉȹt \ No newline at end of file +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \ + echo "flash-attn installed"; \ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \ + python3 -m pip install -r requirements.txt + +# --- Default command --- +CMD ["python3", "-u", "handler.py"] From 5b5147dfe56fa958947877f38b337df353fe5d10 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 10:51:27 -0500 Subject: [PATCH 39/49] Update Dockerfile --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fff62f70..6b3dd72e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,8 +30,10 @@ RUN python3 -m pip install --upgrade pip && \ echo "flash-attn installed"; \ else \ echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi && \ - python3 -m pip install -r requirements.txt + fi + +RUN python3 -m pip install -r requirements.txt # --- Default command --- CMD ["python3", "-u", "handler.py"] + From 100204b7d50adc85f850d4c2c0f5032d57a76198 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:01:44 -0500 Subject: [PATCH 40/49] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6b3dd72e..be569ed2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,9 @@ RUN python3 -m pip install --upgrade pip && \ echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ fi -RUN python3 -m pip install -r requirements.txt +RUN python3 -m pip install --no-build-isolation -r requirements.txt # --- Default command --- CMD ["python3", "-u", "handler.py"] + From fa8ddf6a59e9675f3765b77e0b3cea2eddc1d96d Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:14:22 -0500 Subject: [PATCH 41/49] Update Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index be569ed2..adf5b325 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ COPY . . # --- Install Python dependencies --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_CACHE_DIR=1 +ENV CUDA_HOME=/usr/local/cuda-12.1 ARG INSTALL_FLASH_ATTN=false RUN python3 -m pip install --upgrade pip && \ python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ @@ -38,3 +39,5 @@ RUN python3 -m pip install --no-build-isolation -r requirements.txt CMD ["python3", "-u", "handler.py"] + + From 227d51cf9c0b7aa67c7bc504f8fa6a73fc1c7368 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:34:14 -0500 Subject: [PATCH 42/49] Update Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index adf5b325..a59139c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ COPY . . ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_CACHE_DIR=1 ENV CUDA_HOME=/usr/local/cuda-12.1 +ENV PATH="/usr/local/cuda-12.1/bin:${PATH}" ARG INSTALL_FLASH_ATTN=false RUN python3 -m pip install --upgrade pip && \ python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ @@ -41,3 +42,5 @@ CMD ["python3", "-u", "handler.py"] + + From 17fc56adfe530891af75b7efa45e925cc598d263 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:45:26 -0500 Subject: [PATCH 43/49] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index a59139c3..308d02e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,3 +44,5 @@ CMD ["python3", "-u", "handler.py"] + + From b8ba803fa37fe1583bfb7f4f972db2a8be0fa494 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:05:10 -0500 Subject: [PATCH 44/49] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 308d02e3..097960a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 +FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 # --- Set environment variables for non-interactive installs --- ENV DEBIAN_FRONTEND=noninteractive @@ -16,8 +16,6 @@ COPY . . # --- Install Python dependencies --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_CACHE_DIR=1 -ENV CUDA_HOME=/usr/local/cuda-12.1 -ENV PATH="/usr/local/cuda-12.1/bin:${PATH}" ARG INSTALL_FLASH_ATTN=false RUN python3 -m pip install --upgrade pip && \ python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ @@ -46,3 +44,5 @@ CMD ["python3", "-u", "handler.py"] + + From 103946119fe019e5adf507f7dc4e210fef7453f1 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:18:07 -0500 Subject: [PATCH 45/49] Update Dockerfile --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 097960a0..23a13c1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,9 @@ COPY . . # --- Install Python dependencies --- ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ PIP_NO_CACHE_DIR=1 -ARG INSTALL_FLASH_ATTN=false +ARG INSTALL_FLASH_ATTN=true RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ + python3 -m pip install packaging setuptools wheel pybind11 cmake ninja psutil && \ python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ torch==2.5.1+cu121 \ torchvision==0.20.1+cu121 \ @@ -46,3 +46,5 @@ CMD ["python3", "-u", "handler.py"] + + From d8d41963ddc212f636e34b384d32b8866c3e5560 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Thu, 30 Oct 2025 13:02:46 -0500 Subject: [PATCH 46/49] Adjust Docker build to make flash-attn optional --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 +-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 23a13c1a..b182e72d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +<<<<<<< HEAD # --- Base image --- FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 @@ -48,3 +49,42 @@ CMD ["python3", "-u", "handler.py"] +======= +# --- Base image --- +FROM nvidia/cuda:12.1.1-base-ubuntu22.04 + +# --- Set environment variables for non-interactive installs --- +ENV DEBIAN_FRONTEND=noninteractive + +# --- Install system dependencies --- +RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* + +# --- Working directory --- +WORKDIR /workspace + +# --- Copy project files --- +COPY . . + +# --- Install Python dependencies --- +ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ + PIP_NO_CACHE_DIR=1 +ARG INSTALL_FLASH_ATTN=false +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ + python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ + torch==2.5.1+cu121 \ + torchvision==0.20.1+cu121 \ + torchaudio==2.5.1+cu121 && \ + python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ + if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ + echo "Attempting flash-attn install"; \ + python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \ + echo "flash-attn installed"; \ + else \ + echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ + fi && \ + python3 -m pip install -r requirements.txt + +# --- Default command --- +CMD ["python3", "-u", "handler.py"] +>>>>>>> d1c98cb (Adjust Docker build to make flash-attn optional) diff --git a/requirements.txt b/requirements.txt index 59274655..c57e7b96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,5 +12,4 @@ easydict ftfy dashscope imageio-ffmpeg -flash_attn -numpy>=1.23.5,<2 \ No newline at end of file +numpy>=1.23.5,<2 From 6d7c021f6d872ea91385da78cec7dd8003000389 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:26:09 -0500 Subject: [PATCH 47/49] Switch Dockerfile to ComfyUI runtime --- Dockerfile | 141 ++++++++++++++++++++++------------------------------- 1 file changed, 57 insertions(+), 84 deletions(-) diff --git a/Dockerfile b/Dockerfile index b182e72d..e74a40fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,90 +1,63 @@ -<<<<<<< HEAD -# --- Base image --- -FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 - -# --- Set environment variables for non-interactive installs --- -ENV DEBIAN_FRONTEND=noninteractive - -# --- Install system dependencies --- -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* - -# --- Working directory --- -WORKDIR /workspace - -# --- Copy project files --- -COPY . . - -# --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_CACHE_DIR=1 -ARG INSTALL_FLASH_ATTN=true -RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install packaging setuptools wheel pybind11 cmake ninja psutil && \ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ - if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \ - echo "flash-attn installed"; \ - else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi - -RUN python3 -m pip install --no-build-isolation -r requirements.txt - -# --- Default command --- -CMD ["python3", "-u", "handler.py"] - - - - - - - - - - - - -======= -# --- Base image --- -FROM nvidia/cuda:12.1.1-base-ubuntu22.04 +# --- Base image (pre-built ComfyUI + CUDA + Torch) --- +FROM wlsdml1114/multitalk-base:1.7 as runtime -# --- Set environment variables for non-interactive installs --- -ENV DEBIAN_FRONTEND=noninteractive - -# --- Install system dependencies --- -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip git libgl1-mesa-glx ffmpeg && rm -rf /var/lib/apt/lists/* +# --- Install required utilities --- +RUN pip install -U "huggingface_hub[hf_transfer]" runpod websocket-client onnxruntime-gpu==1.22 # --- Working directory --- -WORKDIR /workspace +WORKDIR / + +# --- Clone ComfyUI core and essential nodes --- +RUN git clone https://github.com/comfyanonymous/ComfyUI.git && \ + cd /ComfyUI && pip install -r requirements.txt + +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/Comfy-Org/ComfyUI-Manager.git && \ + cd ComfyUI-Manager && pip install -r requirements.txt + +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/kijai/ComfyUI-WanVideoWrapper && \ + cd ComfyUI-WanVideoWrapper && pip install -r requirements.txt + +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/kijai/ComfyUI-KJNodes && \ + cd ComfyUI-KJNodes && pip install -r requirements.txt + +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite && \ + cd ComfyUI-VideoHelperSuite && pip install -r requirements.txt + +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/kijai/ComfyUI-WanAnimatePreprocess && \ + cd ComfyUI-WanAnimatePreprocess && pip install -r requirements.txt + +# --- Extra helper nodes --- +RUN cd /ComfyUI/custom_nodes && \ + git clone https://github.com/kijai/ComfyUI-segment-anything-2 && \ + git clone https://github.com/eddyhhlure1Eddy/IntelligentVRAMNode && \ + git clone https://github.com/eddyhhlure1Eddy/auto_wan2.2animate_freamtowindow_server && \ + git clone https://github.com/eddyhhlure1Eddy/ComfyUI-AdaptiveWindowSize && \ + cd ComfyUI-AdaptiveWindowSize/ComfyUI-AdaptiveWindowSize && mv * ../ + +# --- Preload required models (these stay small, the rest load dynamically from HuggingFace) --- +RUN mkdir -p /ComfyUI/models/{vae,clip_vision,text_encoders,diffusion_models,loras,detection} + +RUN wget -q https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors -O /ComfyUI/models/vae/Wan2_1_VAE_bf16.safetensors +RUN wget -q https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/clip_vision/clip_vision_h.safetensors -O /ComfyUI/models/clip_vision/clip_vision_h.safetensors +RUN wget -q https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-bf16.safetensors -O /ComfyUI/models/text_encoders/umt5-xxl-enc-bf16.safetensors +RUN wget -q https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/Wan22Animate/Wan2_2-Animate-14B_fp8_e4m3fn_scaled_KJ.safetensors -O /ComfyUI/models/diffusion_models/Wan2_2-Animate-14B_fp8_e4m3fn_scaled_KJ.safetensors + +RUN wget -q https://huggingface.co/eddy1111111/lightx2v_it2v_adaptive_fusionv_1.safetensors/resolve/main/lightx2v_elite_it2v_animate_face.safetensors -O /ComfyUI/models/loras/lightx2v_elite_it2v_animate_face.safetensors +RUN wget -q https://huggingface.co/eddy1111111/lightx2v_it2v_adaptive_fusionv_1.safetensors/resolve/main/WAN22_MoCap_fullbodyCOPY_ED.safetensors -O /ComfyUI/models/loras/WAN22_MoCap_fullbodyCOPY_ED.safetensors +RUN wget -q https://huggingface.co/eddy1111111/lightx2v_it2v_adaptive_fusionv_1.safetensors/resolve/main/FullDynamic_Ultimate_Fusion_Elite.safetensors -O /ComfyUI/models/loras/FullDynamic_Ultimate_Fusion_Elite.safetensors +RUN wget -q https://huggingface.co/eddy1111111/lightx2v_it2v_adaptive_fusionv_1.safetensors/resolve/main/Wan2.2-Fun-A14B-InP-Fusion-Elite.safetensors -O /ComfyUI/models/loras/Wan2.2-Fun-A14B-InP-Fusion-Elite.safetensors -# --- Copy project files --- -COPY . . +RUN wget -q https://huggingface.co/Wan-AI/Wan2.2-Animate-14B/resolve/main/process_checkpoint/det/yolov10m.onnx -O /ComfyUI/models/detection/yolov10m.onnx +RUN wget -q https://huggingface.co/Kijai/vitpose_comfy/resolve/main/onnx/vitpose_h_wholebody_model.onnx -O /ComfyUI/models/detection/vitpose_h_wholebody_model.onnx +RUN wget -q https://huggingface.co/Kijai/vitpose_comfy/resolve/main/onnx/vitpose_h_wholebody_data.bin -O /ComfyUI/models/detection/vitpose_h_wholebody_data.bin -# --- Install Python dependencies --- -ENV TORCH_CUDA_INDEX_URL=https://download.pytorch.org/whl/cu121 \ - PIP_NO_CACHE_DIR=1 -ARG INSTALL_FLASH_ATTN=false -RUN python3 -m pip install --upgrade pip && \ - python3 -m pip install packaging setuptools wheel pybind11 cmake ninja && \ - python3 -m pip install --extra-index-url ${TORCH_CUDA_INDEX_URL} \ - torch==2.5.1+cu121 \ - torchvision==0.20.1+cu121 \ - torchaudio==2.5.1+cu121 && \ - python3 -c "import torch; print('Torch', torch.__version__, 'available.')" && \ - if [ "${INSTALL_FLASH_ATTN}" = "true" ]; then \ - echo "Attempting flash-attn install"; \ - python3 -m pip install --no-build-isolation flash-attn==2.8.3 && \ - echo "flash-attn installed"; \ - else \ - echo "Skipping flash-attn install (set INSTALL_FLASH_ATTN=true to attempt)"; \ - fi && \ - python3 -m pip install -r requirements.txt +# --- Copy your repo files and entrypoint script --- +COPY . / +RUN chmod +x /entrypoint.sh -# --- Default command --- -CMD ["python3", "-u", "handler.py"] ->>>>>>> d1c98cb (Adjust Docker build to make flash-attn optional) +CMD ["/entrypoint.sh"] From a977e9dc367ef1114f4e58ab53ce2ff8682df07e Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Sat, 1 Nov 2025 09:58:26 -0500 Subject: [PATCH 48/49] Add entrypoint for ComfyUI container --- entrypoint.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..497dc036 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +# If a workflow path is passed in WORKFLOW_JSON, load it +if [[ -n "${WORKFLOW_JSON:-}" ]]; then + echo "Applying workflow from WORKFLOW_JSON" + cp "$WORKFLOW_JSON" /workspace/workflow.json +fi + +# Default to launching ComfyUI server +cd /ComfyUI +exec python main.py --listen 0.0.0.0 --port "${PORT:-8188}" "$@" From 5e562ac0157be5f8400bd7e81f5f284af98d41c5 Mon Sep 17 00:00:00 2001 From: porta7667 <157406065+porta7667@users.noreply.github.com> Date: Mon, 3 Nov 2025 11:01:54 -0600 Subject: [PATCH 49/49] Update ComfyUI runtime Dockerfile --- Dockerfile | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index e74a40fe..39ff58da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # --- Base image (pre-built ComfyUI + CUDA + Torch) --- -FROM wlsdml1114/multitalk-base:1.7 as runtime +FROM wlsdml1114/multitalk-base:1.7 AS runtime # --- Install required utilities --- RUN pip install -U "huggingface_hub[hf_transfer]" runpod websocket-client onnxruntime-gpu==1.22 @@ -8,36 +8,43 @@ RUN pip install -U "huggingface_hub[hf_transfer]" runpod websocket-client onnxru WORKDIR / # --- Clone ComfyUI core and essential nodes --- -RUN git clone https://github.com/comfyanonymous/ComfyUI.git && \ - cd /ComfyUI && pip install -r requirements.txt +RUN git clone --depth=1 https://github.com/comfyanonymous/ComfyUI.git && \ + cd /ComfyUI && pip install -r requirements.txt && \ + rm -rf .git RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/Comfy-Org/ComfyUI-Manager.git && \ - cd ComfyUI-Manager && pip install -r requirements.txt + git clone --depth=1 https://github.com/Comfy-Org/ComfyUI-Manager.git && \ + cd ComfyUI-Manager && pip install -r requirements.txt && \ + cd .. && rm -rf ComfyUI-Manager/.git RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/kijai/ComfyUI-WanVideoWrapper && \ - cd ComfyUI-WanVideoWrapper && pip install -r requirements.txt + git clone --depth=1 https://github.com/kijai/ComfyUI-WanVideoWrapper && \ + cd ComfyUI-WanVideoWrapper && pip install -r requirements.txt && \ + cd .. && rm -rf ComfyUI-WanVideoWrapper/.git RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/kijai/ComfyUI-KJNodes && \ - cd ComfyUI-KJNodes && pip install -r requirements.txt + git clone --depth=1 https://github.com/kijai/ComfyUI-KJNodes && \ + cd ComfyUI-KJNodes && pip install -r requirements.txt && \ + cd .. && rm -rf ComfyUI-KJNodes/.git RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite && \ - cd ComfyUI-VideoHelperSuite && pip install -r requirements.txt + git clone --depth=1 https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite && \ + cd ComfyUI-VideoHelperSuite && pip install -r requirements.txt && \ + cd .. && rm -rf ComfyUI-VideoHelperSuite/.git RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/kijai/ComfyUI-WanAnimatePreprocess && \ - cd ComfyUI-WanAnimatePreprocess && pip install -r requirements.txt + git clone --depth=1 https://github.com/kijai/ComfyUI-WanAnimatePreprocess && \ + cd ComfyUI-WanAnimatePreprocess && pip install -r requirements.txt && \ + cd .. && rm -rf ComfyUI-WanAnimatePreprocess/.git # --- Extra helper nodes --- RUN cd /ComfyUI/custom_nodes && \ - git clone https://github.com/kijai/ComfyUI-segment-anything-2 && \ - git clone https://github.com/eddyhhlure1Eddy/IntelligentVRAMNode && \ - git clone https://github.com/eddyhhlure1Eddy/auto_wan2.2animate_freamtowindow_server && \ - git clone https://github.com/eddyhhlure1Eddy/ComfyUI-AdaptiveWindowSize && \ - cd ComfyUI-AdaptiveWindowSize/ComfyUI-AdaptiveWindowSize && mv * ../ + git clone --depth=1 https://github.com/kijai/ComfyUI-segment-anything-2 && rm -rf ComfyUI-segment-anything-2/.git && \ + git clone --depth=1 https://github.com/eddyhhlure1Eddy/IntelligentVRAMNode && rm -rf IntelligentVRAMNode/.git && \ + git clone --depth=1 https://github.com/eddyhhlure1Eddy/auto_wan2.2animate_freamtowindow_server && rm -rf auto_wan2.2animate_freamtowindow_server/.git && \ + git clone --depth=1 https://github.com/eddyhhlure1Eddy/ComfyUI-AdaptiveWindowSize && \ + cd ComfyUI-AdaptiveWindowSize/ComfyUI-AdaptiveWindowSize && mv * ../ && \ + cd .. && rm -rf ComfyUI-AdaptiveWindowSize/.git # --- Preload required models (these stay small, the rest load dynamically from HuggingFace) --- RUN mkdir -p /ComfyUI/models/{vae,clip_vision,text_encoders,diffusion_models,loras,detection}