Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3a5a7e0
Add base64 encoding for MP4 video output
porta7667 Oct 27, 2025
c7880c6
Add custom RunPod endpoint configuration for Wan2.2
porta7667 Oct 27, 2025
324636d
Add tests.json for basic video test configuration
porta7667 Oct 27, 2025
1207a11
Add Dockerfile for project setup and dependencies
porta7667 Oct 27, 2025
e1676ef
Rename wan/Dockerfile to Dockerfile
porta7667 Oct 27, 2025
4b05290
Implement handler function for video processing
porta7667 Oct 27, 2025
7d73a16
Fix video encoding return statement in handler.py
porta7667 Oct 27, 2025
290fbc6
Update handler.py
porta7667 Oct 27, 2025
121942a
Update Dockerfile
porta7667 Oct 27, 2025
f7f0f02
Install PyTorch and related packages in Dockerfile
porta7667 Oct 28, 2025
06e4e11
Change base image to nvidia/cuda:12.1.1-base-ubuntu22.04
porta7667 Oct 28, 2025
6b392ad
Install Python and dependencies in Dockerfile
porta7667 Oct 28, 2025
1401539
Update Dockerfile
porta7667 Oct 28, 2025
d06dd68
Update PyTorch and related package versions
porta7667 Oct 28, 2025
e148945
Update Dockerfile
porta7667 Oct 28, 2025
f27639a
Add packaging and update PyTorch dependencies in Dockerfile
porta7667 Oct 28, 2025
d9ef11e
Update Dockerfile to use python3 for pip installs
porta7667 Oct 28, 2025
adb6f8d
Install git in Dockerfile
porta7667 Oct 29, 2025
73cf9b0
Update Dockerfile to include additional Python packages
porta7667 Oct 29, 2025
a168931
Refactor Dockerfile for clarity and organization
porta7667 Oct 29, 2025
d6c9507
Update Dockerfile
porta7667 Oct 29, 2025
75ba46b
Update Dockerfile
porta7667 Oct 29, 2025
bb985cd
Add default command to run handler.py
porta7667 Oct 29, 2025
f30a2d6
Update Dockerfile
porta7667 Oct 29, 2025
4160fa4
Update Dockerfile to install additional dependencies
porta7667 Oct 29, 2025
cc93567
Update Dockerfile
porta7667 Oct 29, 2025
db5c042
Refactor Dockerfile for better dependency management
porta7667 Oct 29, 2025
af29835
Update Dockerfile
porta7667 Oct 29, 2025
68b24d2
Enhance Dockerfile with CUDA and PyTorch updates
porta7667 Oct 29, 2025
f5b7e9d
Update Dockerfile for CUDA and dependency installation
porta7667 Oct 29, 2025
875a905
Update Dockerfile
porta7667 Oct 29, 2025
ee76b0c
Update Dockerfile
porta7667 Oct 29, 2025
609e9a5
Add libgl1-mesa-glx to Dockerfile dependencies
porta7667 Oct 29, 2025
07e2fc4
Add Dockerfile
porta7667 Oct 29, 2025
61181f0
Merge branch 'main' of https://github.com/porta7667/Wan2.2
porta7667 Oct 29, 2025
4cc1b8f
Fix: Correct syntax, typos, and line endings in Dockerfile
porta7667 Oct 29, 2025
81d95f6
Fix: Correct Dockerfile syntax and content
porta7667 Oct 29, 2025
5a0273b
Fix: Correct Dockerfile syntax and content (for real this time)
porta7667 Oct 29, 2025
8240800
Update Dockerfile
porta7667 Oct 29, 2025
5b5147d
Update Dockerfile
porta7667 Oct 30, 2025
100204b
Update Dockerfile
porta7667 Oct 30, 2025
fa8ddf6
Update Dockerfile
porta7667 Oct 30, 2025
227d51c
Update Dockerfile
porta7667 Oct 30, 2025
17fc56a
Update Dockerfile
porta7667 Oct 30, 2025
b8ba803
Update Dockerfile
porta7667 Oct 30, 2025
1039461
Update Dockerfile
porta7667 Oct 30, 2025
d8d4196
Adjust Docker build to make flash-attn optional
porta7667 Oct 30, 2025
6d7c021
Switch Dockerfile to ComfyUI runtime
porta7667 Oct 31, 2025
a977e9d
Add entrypoint for ComfyUI container
porta7667 Nov 1, 2025
5e562ac
Update ComfyUI runtime Dockerfile
porta7667 Nov 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .runpod/hub.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
}
13 changes: 13 additions & 0 deletions .runpod/tests.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
70 changes: 70 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# --- Base image (pre-built ComfyUI + CUDA + Torch) ---
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

# --- Working directory ---
WORKDIR /

# --- Clone ComfyUI core and essential nodes ---
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 --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 --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 --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 --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 --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 --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}

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

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

# --- Copy your repo files and entrypoint script ---
COPY . /
RUN chmod +x /entrypoint.sh

CMD ["/entrypoint.sh"]
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}" "$@"
24 changes: 24 additions & 0 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
35 changes: 35 additions & 0 deletions handler.py
Original file line number Diff line number Diff line change
@@ -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 {
"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)))
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ easydict
ftfy
dashscope
imageio-ffmpeg
flash_attn
numpy>=1.23.5,<2
numpy>=1.23.5,<2