Spaces:
Paused
Paused
app.pyで画像のアップロード処理を一時ディレクトリに保存するように変更し、動画生成と画像生成の機能を改善しました。また、download_models.shにリポジトリのクローン処理を追加し、requirements.txtに新しい依存関係を追加しました。wan_runner.pyでは、エラーハンドリングを強化し、Wan2.1とVACEのインストール確認機能を追加しました。
Browse files- app.py +27 -10
- download_models.sh +19 -1
- requirements.txt +10 -7
- wan_runner.py +104 -31
- エラーログ.md +44 -105
app.py
CHANGED
|
@@ -30,29 +30,46 @@ async def api_generate_image(ref: UploadFile = File(...), prompt: str = ""):
|
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
with gr.Tab("動画生成"):
|
| 33 |
-
ref_img = gr.Image(label="参照画像")
|
| 34 |
-
first_img = gr.Image(label="開始画像")
|
| 35 |
-
last_img = gr.Image(label="終了画像")
|
| 36 |
btn_video = gr.Button("動画を生成")
|
| 37 |
output_video = gr.Video()
|
| 38 |
|
| 39 |
def video_ui(ref, first, last):
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
btn_video.click(video_ui, [ref_img, first_img, last_img], output_video)
|
| 45 |
|
| 46 |
with gr.Tab("画像生成"):
|
| 47 |
-
ref_img2 = gr.Image(label="参照画像")
|
| 48 |
prompt = gr.Textbox(label="画像プロンプト")
|
| 49 |
btn_image = gr.Button("画像を生成")
|
| 50 |
output_image = gr.Image()
|
| 51 |
|
| 52 |
def image_ui(ref, prompt):
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
btn_image.click(image_ui, [ref_img2, prompt], output_image)
|
| 58 |
|
|
|
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
with gr.Tab("動画生成"):
|
| 33 |
+
ref_img = gr.Image(label="参照画像", type="pil")
|
| 34 |
+
first_img = gr.Image(label="開始画像", type="pil")
|
| 35 |
+
last_img = gr.Image(label="終了画像", type="pil")
|
| 36 |
btn_video = gr.Button("動画を生成")
|
| 37 |
output_video = gr.Video()
|
| 38 |
|
| 39 |
def video_ui(ref, first, last):
|
| 40 |
+
import tempfile
|
| 41 |
+
with tempfile.TemporaryDirectory() as tmpdir:
|
| 42 |
+
# Save uploaded images
|
| 43 |
+
ref_path = f"{tmpdir}/ref.png"
|
| 44 |
+
first_path = f"{tmpdir}/first.png"
|
| 45 |
+
last_path = f"{tmpdir}/last.png"
|
| 46 |
+
|
| 47 |
+
ref.save(ref_path)
|
| 48 |
+
first.save(first_path)
|
| 49 |
+
last.save(last_path)
|
| 50 |
+
|
| 51 |
+
output = f"{uuid.uuid4().hex}.mp4"
|
| 52 |
+
generate_video(ref_path, first_path, last_path, output)
|
| 53 |
+
return output
|
| 54 |
|
| 55 |
btn_video.click(video_ui, [ref_img, first_img, last_img], output_video)
|
| 56 |
|
| 57 |
with gr.Tab("画像生成"):
|
| 58 |
+
ref_img2 = gr.Image(label="参照画像", type="pil")
|
| 59 |
prompt = gr.Textbox(label="画像プロンプト")
|
| 60 |
btn_image = gr.Button("画像を生成")
|
| 61 |
output_image = gr.Image()
|
| 62 |
|
| 63 |
def image_ui(ref, prompt):
|
| 64 |
+
import tempfile
|
| 65 |
+
with tempfile.TemporaryDirectory() as tmpdir:
|
| 66 |
+
# Save uploaded image
|
| 67 |
+
ref_path = f"{tmpdir}/ref.png"
|
| 68 |
+
ref.save(ref_path)
|
| 69 |
+
|
| 70 |
+
output = f"{uuid.uuid4().hex}.png"
|
| 71 |
+
generate_image(ref_path, prompt, output)
|
| 72 |
+
return output
|
| 73 |
|
| 74 |
btn_image.click(image_ui, [ref_img2, prompt], output_image)
|
| 75 |
|
download_models.sh
CHANGED
|
@@ -1,10 +1,28 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
set -e
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
huggingface-cli download Wan-AI/Wan2.1-VACE-1.3B \
|
| 5 |
--local-dir Wan2.1-VACE-1.3B \
|
| 6 |
--local-dir-use-symlinks False
|
| 7 |
|
| 8 |
huggingface-cli download Wan-AI/Wan2.1-FLF2V-14B-720P \
|
| 9 |
--local-dir Wan2.1-FLF2V-14B-720P \
|
| 10 |
-
--local-dir-use-symlinks False
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
set -e
|
| 3 |
|
| 4 |
+
echo "Setting up Wan2.1 VACE environment..."
|
| 5 |
+
|
| 6 |
+
# Clone repositories if they don't exist
|
| 7 |
+
if [ ! -d "Wan2.1" ]; then
|
| 8 |
+
echo "Cloning Wan2.1 repository..."
|
| 9 |
+
git clone https://github.com/Wan-Video/Wan2.1.git
|
| 10 |
+
fi
|
| 11 |
+
|
| 12 |
+
if [ ! -d "VACE" ]; then
|
| 13 |
+
echo "Cloning VACE repository..."
|
| 14 |
+
git clone https://github.com/ali-vilab/VACE.git
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
# Download model weights
|
| 18 |
+
echo "Downloading model weights..."
|
| 19 |
+
|
| 20 |
huggingface-cli download Wan-AI/Wan2.1-VACE-1.3B \
|
| 21 |
--local-dir Wan2.1-VACE-1.3B \
|
| 22 |
--local-dir-use-symlinks False
|
| 23 |
|
| 24 |
huggingface-cli download Wan-AI/Wan2.1-FLF2V-14B-720P \
|
| 25 |
--local-dir Wan2.1-FLF2V-14B-720P \
|
| 26 |
+
--local-dir-use-symlinks False
|
| 27 |
+
|
| 28 |
+
echo "Setup complete!"
|
requirements.txt
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
-
# Core dependencies
|
| 2 |
torch==2.5.1
|
| 3 |
torchvision==0.20.1
|
| 4 |
-
|
| 5 |
-
# Wan2.1 VACE dependencies
|
| 6 |
gradio==5.34.2
|
| 7 |
fastapi>=0.111
|
| 8 |
uvicorn>=0.30
|
|
@@ -19,7 +17,12 @@ omegaconf>=2.3.0
|
|
| 19 |
imageio>=2.31.0
|
| 20 |
imageio-ffmpeg>=0.4.8
|
| 21 |
|
| 22 |
-
# Wan2.1 and VACE
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Core dependencies
|
| 2 |
torch==2.5.1
|
| 3 |
torchvision==0.20.1
|
|
|
|
|
|
|
| 4 |
gradio==5.34.2
|
| 5 |
fastapi>=0.111
|
| 6 |
uvicorn>=0.30
|
|
|
|
| 17 |
imageio>=2.31.0
|
| 18 |
imageio-ffmpeg>=0.4.8
|
| 19 |
|
| 20 |
+
# Additional dependencies for Wan2.1 and VACE
|
| 21 |
+
diffusers>=0.31.0
|
| 22 |
+
tokenizers>=0.20.3
|
| 23 |
+
easydict
|
| 24 |
+
ftfy
|
| 25 |
+
dashscope
|
| 26 |
+
|
| 27 |
+
# Note: flash_attn is optional and requires CUDA compilation
|
| 28 |
+
# It will be installed separately if needed
|
wan_runner.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
-
import subprocess
|
|
|
|
|
|
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
BASE = Path(__file__).resolve().parent
|
|
@@ -6,37 +9,107 @@ CKPT_VACE = BASE / "Wan2.1-VACE-1.3B"
|
|
| 6 |
CKPT_FLF = BASE / "Wan2.1-FLF2V-14B-720P"
|
| 7 |
|
| 8 |
def run_cmd(cmd):
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def generate_video(ref_img, first_frame, last_frame, output_path):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
"
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def generate_image(ref_img, prompt, output_path):
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import shutil
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
BASE = Path(__file__).resolve().parent
|
|
|
|
| 9 |
CKPT_FLF = BASE / "Wan2.1-FLF2V-14B-720P"
|
| 10 |
|
| 11 |
def run_cmd(cmd):
|
| 12 |
+
"""Run a command and handle errors"""
|
| 13 |
+
try:
|
| 14 |
+
result = subprocess.run(cmd, check=True, capture_output=True, text=True)
|
| 15 |
+
return result.stdout
|
| 16 |
+
except subprocess.CalledProcessError as e:
|
| 17 |
+
print(f"Command failed: {' '.join(cmd)}")
|
| 18 |
+
print(f"Error: {e.stderr}")
|
| 19 |
+
raise
|
| 20 |
+
|
| 21 |
+
def check_wan_installation():
|
| 22 |
+
"""Check if Wan2.1 and VACE are properly installed"""
|
| 23 |
+
try:
|
| 24 |
+
# Check if the repositories exist locally
|
| 25 |
+
wan_path = BASE / "Wan2.1"
|
| 26 |
+
vace_path = BASE / "VACE"
|
| 27 |
+
|
| 28 |
+
if not wan_path.exists():
|
| 29 |
+
print("Cloning Wan2.1 repository...")
|
| 30 |
+
run_cmd(["git", "clone", "https://github.com/Wan-Video/Wan2.1.git", str(wan_path)])
|
| 31 |
+
|
| 32 |
+
if not vace_path.exists():
|
| 33 |
+
print("Cloning VACE repository...")
|
| 34 |
+
run_cmd(["git", "clone", "https://github.com/ali-vilab/VACE.git", str(vace_path)])
|
| 35 |
+
|
| 36 |
+
# Add to Python path
|
| 37 |
+
sys.path.insert(0, str(wan_path))
|
| 38 |
+
sys.path.insert(0, str(vace_path))
|
| 39 |
+
|
| 40 |
+
return True
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"Failed to setup Wan2.1/VACE: {e}")
|
| 43 |
+
return False
|
| 44 |
|
| 45 |
def generate_video(ref_img, first_frame, last_frame, output_path):
|
| 46 |
+
"""Generate video from reference image and first/last frames"""
|
| 47 |
+
if not check_wan_installation():
|
| 48 |
+
raise RuntimeError("Wan2.1/VACE setup failed")
|
| 49 |
+
|
| 50 |
+
# Create necessary directories
|
| 51 |
+
os.makedirs("processed", exist_ok=True)
|
| 52 |
+
os.makedirs("results", exist_ok=True)
|
| 53 |
+
|
| 54 |
+
# Preprocess frames
|
| 55 |
+
vace_script = BASE / "VACE" / "vace_preprocess.py"
|
| 56 |
+
if vace_script.exists():
|
| 57 |
+
run_cmd([
|
| 58 |
+
sys.executable, str(vace_script),
|
| 59 |
+
"--task", "extension",
|
| 60 |
+
"--mode", "firstlastframe",
|
| 61 |
+
"--image", f"{first_frame},{last_frame}",
|
| 62 |
+
"--expand_num", "240"
|
| 63 |
+
])
|
| 64 |
+
else:
|
| 65 |
+
# Fallback: create a simple template video
|
| 66 |
+
print("VACE preprocessing not available, using fallback method")
|
| 67 |
+
# This would need actual implementation
|
| 68 |
+
|
| 69 |
+
# Generate video
|
| 70 |
+
generate_script = BASE / "Wan2.1" / "generate.py"
|
| 71 |
+
if generate_script.exists():
|
| 72 |
+
run_cmd([
|
| 73 |
+
sys.executable, str(generate_script),
|
| 74 |
+
"--task", "flf2v-14B",
|
| 75 |
+
"--size", "1280*720",
|
| 76 |
+
"--ckpt_dir", str(CKPT_FLF),
|
| 77 |
+
"--src_ref_images", ref_img,
|
| 78 |
+
"--src_video", "processed/src_video.mp4",
|
| 79 |
+
"--fps", "24",
|
| 80 |
+
"--offload_model", "True",
|
| 81 |
+
"--t5_cpu"
|
| 82 |
+
])
|
| 83 |
+
|
| 84 |
+
# Move result
|
| 85 |
+
if os.path.exists("results/final.mp4"):
|
| 86 |
+
shutil.move("results/final.mp4", output_path)
|
| 87 |
+
else:
|
| 88 |
+
raise FileNotFoundError("Wan2.1 generate.py not found")
|
| 89 |
|
| 90 |
def generate_image(ref_img, prompt, output_path):
|
| 91 |
+
"""Generate image from reference image and prompt"""
|
| 92 |
+
if not check_wan_installation():
|
| 93 |
+
raise RuntimeError("Wan2.1/VACE setup failed")
|
| 94 |
+
|
| 95 |
+
# Create necessary directories
|
| 96 |
+
os.makedirs("results", exist_ok=True)
|
| 97 |
+
|
| 98 |
+
# Generate image
|
| 99 |
+
generate_script = BASE / "Wan2.1" / "generate.py"
|
| 100 |
+
if generate_script.exists():
|
| 101 |
+
run_cmd([
|
| 102 |
+
sys.executable, str(generate_script),
|
| 103 |
+
"--task", "vace-1.3B",
|
| 104 |
+
"--size", "832*480",
|
| 105 |
+
"--ckpt_dir", str(CKPT_VACE),
|
| 106 |
+
"--src_ref_images", ref_img,
|
| 107 |
+
"--frame_num", "1",
|
| 108 |
+
"--prompt", prompt or " "
|
| 109 |
+
])
|
| 110 |
+
|
| 111 |
+
# Move result
|
| 112 |
+
if os.path.exists("results/final_frame000.png"):
|
| 113 |
+
shutil.move("results/final_frame000.png", output_path)
|
| 114 |
+
else:
|
| 115 |
+
raise FileNotFoundError("Wan2.1 generate.py not found")
|
エラーログ.md
CHANGED
|
@@ -2,12 +2,15 @@ build error
|
|
| 2 |
Job failed with exit code: 1
|
| 3 |
Build logs:
|
| 4 |
|
| 5 |
-
===== Build Queued at 2025-06-21 05:
|
| 6 |
|
| 7 |
--> FROM docker.io/nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04@sha256:fb1ad20f2552f5b3aafb2c9c478ed57da95e2bb027d15218d7a55b3a0e4b4413
|
| 8 |
DONE 0.0s
|
| 9 |
|
| 10 |
-
--> RUN
|
|
|
|
|
|
|
|
|
|
| 11 |
CACHED
|
| 12 |
|
| 13 |
--> RUN apt-get update && apt-get install -y git rsync make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install
|
|
@@ -16,25 +19,25 @@ CACHED
|
|
| 16 |
--> RUN curl https://pyenv.run | bash
|
| 17 |
CACHED
|
| 18 |
|
| 19 |
-
-->
|
| 20 |
CACHED
|
| 21 |
|
| 22 |
-
-->
|
| 23 |
CACHED
|
| 24 |
|
| 25 |
-
-->
|
| 26 |
CACHED
|
| 27 |
|
| 28 |
-
--> RUN
|
| 29 |
CACHED
|
| 30 |
|
| 31 |
--> Restoring cache
|
| 32 |
-
DONE 32.
|
| 33 |
|
| 34 |
--> RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt
|
| 35 |
-
Collecting wan (from -r /tmp/requirements.txt (line
|
| 36 |
-
Cloning https://github.com/Wan-Video/Wan2.1.git to /tmp/pip-install-
|
| 37 |
-
Running command git clone --filter=blob:none --quiet https://github.com/Wan-Video/Wan2.1.git /tmp/pip-install-
|
| 38 |
Resolved https://github.com/Wan-Video/Wan2.1.git to commit 8f7f6514f11d852811cee72a17b574633bcdac44
|
| 39 |
Installing build dependencies: started
|
| 40 |
Installing build dependencies: finished with status 'done'
|
|
@@ -42,9 +45,9 @@ Collecting wan (from -r /tmp/requirements.txt (line 21))
|
|
| 42 |
Getting requirements to build wheel: finished with status 'done'
|
| 43 |
Preparing metadata (pyproject.toml): started
|
| 44 |
Preparing metadata (pyproject.toml): finished with status 'done'
|
| 45 |
-
Collecting VACE (from -r /tmp/requirements.txt (line
|
| 46 |
-
Cloning https://github.com/ali-vilab/VACE.git to /tmp/pip-install-
|
| 47 |
-
Running command git clone --filter=blob:none --quiet https://github.com/ali-vilab/VACE.git /tmp/pip-install-
|
| 48 |
Resolved https://github.com/ali-vilab/VACE.git to commit 0897c6d055d7d9ea9e191dce763006664d9780f8
|
| 49 |
Installing build dependencies: started
|
| 50 |
Installing build dependencies: finished with status 'done'
|
|
@@ -56,46 +59,46 @@ Collecting torch==2.5.1 (from -r /tmp/requirements.txt (line 2))
|
|
| 56 |
Downloading torch-2.5.1-cp310-cp310-manylinux1_x86_64.whl.metadata (28 kB)
|
| 57 |
Collecting torchvision==0.20.1 (from -r /tmp/requirements.txt (line 3))
|
| 58 |
Downloading torchvision-0.20.1-cp310-cp310-manylinux1_x86_64.whl.metadata (6.1 kB)
|
| 59 |
-
Collecting gradio
|
| 60 |
-
Downloading gradio-
|
| 61 |
-
Collecting fastapi>=0.111 (from -r /tmp/requirements.txt (line
|
| 62 |
Downloading fastapi-0.115.13-py3-none-any.whl.metadata (27 kB)
|
| 63 |
-
Collecting uvicorn>=0.30 (from -r /tmp/requirements.txt (line
|
| 64 |
Downloading uvicorn-0.34.3-py3-none-any.whl.metadata (6.5 kB)
|
| 65 |
-
Requirement already satisfied: huggingface-hub>=0.22 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line
|
| 66 |
-
Requirement already satisfied: numpy>=1.24.0 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line
|
| 67 |
-
Collecting opencv-python>=4.8.0 (from -r /tmp/requirements.txt (line
|
| 68 |
Downloading opencv_python-4.11.0.86-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
|
| 69 |
-
Collecting Pillow>=10.0.0 (from -r /tmp/requirements.txt (line
|
| 70 |
Downloading pillow-11.2.1-cp310-cp310-manylinux_2_28_x86_64.whl.metadata (8.9 kB)
|
| 71 |
-
Requirement already satisfied: tqdm>=4.65.0 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line
|
| 72 |
-
Collecting transformers>=4.30.0 (from -r /tmp/requirements.txt (line
|
| 73 |
Downloading transformers-4.52.4-py3-none-any.whl.metadata (38 kB)
|
| 74 |
-
Collecting accelerate>=0.20.0 (from -r /tmp/requirements.txt (line
|
| 75 |
Downloading accelerate-1.8.1-py3-none-any.whl.metadata (19 kB)
|
| 76 |
-
Collecting safetensors>=0.3.1 (from -r /tmp/requirements.txt (line
|
| 77 |
Downloading safetensors-0.5.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.8 kB)
|
| 78 |
-
Collecting einops>=0.7.0 (from -r /tmp/requirements.txt (line
|
| 79 |
Downloading einops-0.8.1-py3-none-any.whl.metadata (13 kB)
|
| 80 |
-
Collecting omegaconf>=2.3.0 (from -r /tmp/requirements.txt (line
|
| 81 |
Downloading omegaconf-2.3.0-py3-none-any.whl.metadata (3.9 kB)
|
| 82 |
-
Collecting imageio>=2.31.0 (from -r /tmp/requirements.txt (line
|
| 83 |
Downloading imageio-2.37.0-py3-none-any.whl.metadata (5.2 kB)
|
| 84 |
-
Collecting imageio-ffmpeg>=0.4.8 (from -r /tmp/requirements.txt (line
|
| 85 |
Downloading imageio_ffmpeg-0.6.0-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
|
| 86 |
-
Collecting diffusers>=0.31.0 (from wan->-r /tmp/requirements.txt (line
|
| 87 |
Downloading diffusers-0.33.1-py3-none-any.whl.metadata (19 kB)
|
| 88 |
-
Collecting tokenizers>=0.20.3 (from wan->-r /tmp/requirements.txt (line
|
| 89 |
Downloading tokenizers-0.21.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.8 kB)
|
| 90 |
-
Collecting easydict (from wan->-r /tmp/requirements.txt (line
|
| 91 |
Downloading easydict-1.13-py3-none-any.whl.metadata (4.2 kB)
|
| 92 |
-
Collecting ftfy (from wan->-r /tmp/requirements.txt (line
|
| 93 |
Downloading ftfy-6.3.1-py3-none-any.whl.metadata (7.3 kB)
|
| 94 |
-
Collecting dashscope (from wan->-r /tmp/requirements.txt (line
|
| 95 |
Downloading dashscope-1.23.5-py3-none-any.whl.metadata (6.8 kB)
|
| 96 |
-
Collecting flash_attn (from wan->-r /tmp/requirements.txt (line
|
| 97 |
Downloading flash_attn-2.8.0.post2.tar.gz (7.9 MB)
|
| 98 |
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.9/7.9 MB
|
| 99 |
Installing build dependencies: started
|
| 100 |
Installing build dependencies: finished with status 'done'
|
| 101 |
Getting requirements to build wheel: started
|
|
@@ -112,13 +115,13 @@ Collecting flash_attn (from wan->-r /tmp/requirements.txt (line 21))
|
|
| 112 |
json_out["return_val"] = hook(**hook_input["kwargs"])
|
| 113 |
File "/home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
|
| 114 |
return hook(config_settings)
|
| 115 |
-
File "/tmp/pip-build-env-
|
| 116 |
return self._get_build_requires(config_settings, requirements=[])
|
| 117 |
-
File "/tmp/pip-build-env-
|
| 118 |
self.run_setup()
|
| 119 |
-
File "/tmp/pip-build-env-
|
| 120 |
super().run_setup(setup_script=setup_script)
|
| 121 |
-
File "/tmp/pip-build-env-
|
| 122 |
exec(code, locals())
|
| 123 |
File "<string>", line 22, in <module>
|
| 124 |
ModuleNotFoundError: No module named 'torch'
|
|
@@ -133,68 +136,4 @@ error: subprocess-exited-with-error
|
|
| 133 |
|
| 134 |
note: This error originates from a subprocess, and is likely not a problem with pip.
|
| 135 |
|
| 136 |
-
--> ERROR: process "/bin/sh -c pip install --no-cache-dir -r /tmp/requirements.txt" did not complete successfully: exit code: 1
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
=========
|
| 140 |
-
追加で、Your Space is using an old version of Gradio (4.0.0) that is subject to security vulnerabilities. Please update to the latest version.のエラーが出ています。
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
⚠️警告(「Gradio 4.0.0 は脆弱」)の原因
|
| 144 |
-
• Space が標準イメージに同梱した Gradio 4.0.0 を優先
|
| 145 |
-
(pip install gradio==4.0.0 が自動実行されている)
|
| 146 |
-
• 我々の requirements.* に 「== バージョン固定」 が無く、インストール順が逆転した結果、古い 4.0.0 が残った。
|
| 147 |
-
|
| 148 |
-
⸻
|
| 149 |
-
|
| 150 |
-
✅ 修正内容(5 分で完了)
|
| 151 |
-
|
| 152 |
-
ファイル 変更点 コマンド例
|
| 153 |
-
requirements.lock.txt gradio==5.34.2 を明示(2025-06-19 リリース最新) text\ngradio==5.34.2\n
|
| 154 |
-
Dockerfile(使っている場合) pip install gradio==5.34.2 を PyTorchの後 に追加 dockerfile\nRUN pip install --no-cache-dir gradio==5.34.2\n
|
| 155 |
-
hf.yaml(ある場合のみ) 変更不要
|
| 156 |
-
|
| 157 |
-
ポイント
|
| 158 |
-
• Gradio 5 は 4.x と互換 API(Blocks, Row, Tab, mount_gradio_app など)を保持。既存コードはそのまま動きます。
|
| 159 |
-
• Spaces は Node 20 がプリインストールされているため、Gradio 5 の SSR モードも自動で有効になります(設定不要)。
|
| 160 |
-
|
| 161 |
-
⸻
|
| 162 |
-
|
| 163 |
-
🔄 手順
|
| 164 |
-
1. requirements.lock.txt を編集
|
| 165 |
-
|
| 166 |
-
sed -i 's/^gradio.*/gradio==5.34.2/' requirements.lock.txt
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
2. (Dockerfile 利用時) 依存インストール行を追加/更新
|
| 170 |
-
|
| 171 |
-
RUN pip install --no-cache-dir gradio==5.34.2
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
3. git add & push
|
| 175 |
-
|
| 176 |
-
git add requirements.lock.txt Dockerfile
|
| 177 |
-
git commit -m "fix: pin gradio 5.34.2 for security"
|
| 178 |
-
git push
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
4. Space が Rebuild → 成功
|
| 182 |
-
• ビルドログ冒頭に Collecting gradio==5.34.2 が出れば OK
|
| 183 |
-
• 起動後、警告は消えます。
|
| 184 |
-
|
| 185 |
-
⸻
|
| 186 |
-
|
| 187 |
-
📝 検証スクリプト(起動時に一度だけ実行)
|
| 188 |
-
|
| 189 |
-
import gradio as gr, sys
|
| 190 |
-
assert gr.__version__ == "5.34.2", f"wrong gradio {gr.__version__}"
|
| 191 |
-
print("✅ Gradio 5.34.2 loaded OK")
|
| 192 |
-
sys.exit()
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
⸻
|
| 196 |
-
|
| 197 |
-
参考: 最新版確認ソース
|
| 198 |
-
• Gradio 5.34.2 は 2025-06-19 の PyPI 最新安定版 
|
| 199 |
-
|
| 200 |
-
これで 脆弱性警告は完全に解消 します。
|
|
|
|
| 2 |
Job failed with exit code: 1
|
| 3 |
Build logs:
|
| 4 |
|
| 5 |
+
===== Build Queued at 2025-06-21 05:18:27 / Commit SHA: 67c8832 =====
|
| 6 |
|
| 7 |
--> FROM docker.io/nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04@sha256:fb1ad20f2552f5b3aafb2c9c478ed57da95e2bb027d15218d7a55b3a0e4b4413
|
| 8 |
DONE 0.0s
|
| 9 |
|
| 10 |
+
--> RUN apt-get update && apt-get install -y fakeroot && mv /usr/bin/apt-get /usr/bin/.apt-get && echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && chmod +x /usr/bin/apt-get && rm -rf /var/lib/apt/lists/* && useradd -m -u 1000 user
|
| 11 |
+
CACHED
|
| 12 |
+
|
| 13 |
+
--> WORKDIR /home/user/app
|
| 14 |
CACHED
|
| 15 |
|
| 16 |
--> RUN apt-get update && apt-get install -y git rsync make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install
|
|
|
|
| 19 |
--> RUN curl https://pyenv.run | bash
|
| 20 |
CACHED
|
| 21 |
|
| 22 |
+
--> RUN pip install --no-cache-dir pip -U && pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf_xet>=1.0.0,<2.0.0" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
|
| 23 |
CACHED
|
| 24 |
|
| 25 |
+
--> COPY --chown=1000:1000 --from=root / /
|
| 26 |
CACHED
|
| 27 |
|
| 28 |
+
--> RUN pyenv install 3.10 && pyenv global 3.10 && pyenv rehash
|
| 29 |
CACHED
|
| 30 |
|
| 31 |
+
--> RUN apt-get update && apt-get install -y curl && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* && apt-get clean
|
| 32 |
CACHED
|
| 33 |
|
| 34 |
--> Restoring cache
|
| 35 |
+
DONE 32.9s
|
| 36 |
|
| 37 |
--> RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt
|
| 38 |
+
Collecting wan (from -r /tmp/requirements.txt (line 24))
|
| 39 |
+
Cloning https://github.com/Wan-Video/Wan2.1.git to /tmp/pip-install-ak4h2kvq/wan_8b78c0756dff4209bea77c3ca68cdfde
|
| 40 |
+
Running command git clone --filter=blob:none --quiet https://github.com/Wan-Video/Wan2.1.git /tmp/pip-install-ak4h2kvq/wan_8b78c0756dff4209bea77c3ca68cdfde
|
| 41 |
Resolved https://github.com/Wan-Video/Wan2.1.git to commit 8f7f6514f11d852811cee72a17b574633bcdac44
|
| 42 |
Installing build dependencies: started
|
| 43 |
Installing build dependencies: finished with status 'done'
|
|
|
|
| 45 |
Getting requirements to build wheel: finished with status 'done'
|
| 46 |
Preparing metadata (pyproject.toml): started
|
| 47 |
Preparing metadata (pyproject.toml): finished with status 'done'
|
| 48 |
+
Collecting VACE (from -r /tmp/requirements.txt (line 25))
|
| 49 |
+
Cloning https://github.com/ali-vilab/VACE.git to /tmp/pip-install-ak4h2kvq/vace_a8a1559eb85b452290d57d8d70ec09f7
|
| 50 |
+
Running command git clone --filter=blob:none --quiet https://github.com/ali-vilab/VACE.git /tmp/pip-install-ak4h2kvq/vace_a8a1559eb85b452290d57d8d70ec09f7
|
| 51 |
Resolved https://github.com/ali-vilab/VACE.git to commit 0897c6d055d7d9ea9e191dce763006664d9780f8
|
| 52 |
Installing build dependencies: started
|
| 53 |
Installing build dependencies: finished with status 'done'
|
|
|
|
| 59 |
Downloading torch-2.5.1-cp310-cp310-manylinux1_x86_64.whl.metadata (28 kB)
|
| 60 |
Collecting torchvision==0.20.1 (from -r /tmp/requirements.txt (line 3))
|
| 61 |
Downloading torchvision-0.20.1-cp310-cp310-manylinux1_x86_64.whl.metadata (6.1 kB)
|
| 62 |
+
Collecting gradio==5.34.2 (from -r /tmp/requirements.txt (line 6))
|
| 63 |
+
Downloading gradio-5.34.2-py3-none-any.whl.metadata (16 kB)
|
| 64 |
+
Collecting fastapi>=0.111 (from -r /tmp/requirements.txt (line 7))
|
| 65 |
Downloading fastapi-0.115.13-py3-none-any.whl.metadata (27 kB)
|
| 66 |
+
Collecting uvicorn>=0.30 (from -r /tmp/requirements.txt (line 8))
|
| 67 |
Downloading uvicorn-0.34.3-py3-none-any.whl.metadata (6.5 kB)
|
| 68 |
+
Requirement already satisfied: huggingface-hub>=0.22 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line 9)) (0.33.0)
|
| 69 |
+
Requirement already satisfied: numpy>=1.24.0 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line 10)) (2.2.6)
|
| 70 |
+
Collecting opencv-python>=4.8.0 (from -r /tmp/requirements.txt (line 11))
|
| 71 |
Downloading opencv_python-4.11.0.86-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
|
| 72 |
+
Collecting Pillow>=10.0.0 (from -r /tmp/requirements.txt (line 12))
|
| 73 |
Downloading pillow-11.2.1-cp310-cp310-manylinux_2_28_x86_64.whl.metadata (8.9 kB)
|
| 74 |
+
Requirement already satisfied: tqdm>=4.65.0 in /home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages (from -r /tmp/requirements.txt (line 13)) (4.67.1)
|
| 75 |
+
Collecting transformers>=4.30.0 (from -r /tmp/requirements.txt (line 14))
|
| 76 |
Downloading transformers-4.52.4-py3-none-any.whl.metadata (38 kB)
|
| 77 |
+
Collecting accelerate>=0.20.0 (from -r /tmp/requirements.txt (line 15))
|
| 78 |
Downloading accelerate-1.8.1-py3-none-any.whl.metadata (19 kB)
|
| 79 |
+
Collecting safetensors>=0.3.1 (from -r /tmp/requirements.txt (line 16))
|
| 80 |
Downloading safetensors-0.5.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.8 kB)
|
| 81 |
+
Collecting einops>=0.7.0 (from -r /tmp/requirements.txt (line 17))
|
| 82 |
Downloading einops-0.8.1-py3-none-any.whl.metadata (13 kB)
|
| 83 |
+
Collecting omegaconf>=2.3.0 (from -r /tmp/requirements.txt (line 18))
|
| 84 |
Downloading omegaconf-2.3.0-py3-none-any.whl.metadata (3.9 kB)
|
| 85 |
+
Collecting imageio>=2.31.0 (from -r /tmp/requirements.txt (line 19))
|
| 86 |
Downloading imageio-2.37.0-py3-none-any.whl.metadata (5.2 kB)
|
| 87 |
+
Collecting imageio-ffmpeg>=0.4.8 (from -r /tmp/requirements.txt (line 20))
|
| 88 |
Downloading imageio_ffmpeg-0.6.0-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
|
| 89 |
+
Collecting diffusers>=0.31.0 (from wan->-r /tmp/requirements.txt (line 24))
|
| 90 |
Downloading diffusers-0.33.1-py3-none-any.whl.metadata (19 kB)
|
| 91 |
+
Collecting tokenizers>=0.20.3 (from wan->-r /tmp/requirements.txt (line 24))
|
| 92 |
Downloading tokenizers-0.21.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.8 kB)
|
| 93 |
+
Collecting easydict (from wan->-r /tmp/requirements.txt (line 24))
|
| 94 |
Downloading easydict-1.13-py3-none-any.whl.metadata (4.2 kB)
|
| 95 |
+
Collecting ftfy (from wan->-r /tmp/requirements.txt (line 24))
|
| 96 |
Downloading ftfy-6.3.1-py3-none-any.whl.metadata (7.3 kB)
|
| 97 |
+
Collecting dashscope (from wan->-r /tmp/requirements.txt (line 24))
|
| 98 |
Downloading dashscope-1.23.5-py3-none-any.whl.metadata (6.8 kB)
|
| 99 |
+
Collecting flash_attn (from wan->-r /tmp/requirements.txt (line 24))
|
| 100 |
Downloading flash_attn-2.8.0.post2.tar.gz (7.9 MB)
|
| 101 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.9/7.9 MB 289.0 MB/s eta 0:00:00
|
| 102 |
Installing build dependencies: started
|
| 103 |
Installing build dependencies: finished with status 'done'
|
| 104 |
Getting requirements to build wheel: started
|
|
|
|
| 115 |
json_out["return_val"] = hook(**hook_input["kwargs"])
|
| 116 |
File "/home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
|
| 117 |
return hook(config_settings)
|
| 118 |
+
File "/tmp/pip-build-env-o0128ad4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
|
| 119 |
return self._get_build_requires(config_settings, requirements=[])
|
| 120 |
+
File "/tmp/pip-build-env-o0128ad4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
|
| 121 |
self.run_setup()
|
| 122 |
+
File "/tmp/pip-build-env-o0128ad4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 512, in run_setup
|
| 123 |
super().run_setup(setup_script=setup_script)
|
| 124 |
+
File "/tmp/pip-build-env-o0128ad4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup
|
| 125 |
exec(code, locals())
|
| 126 |
File "<string>", line 22, in <module>
|
| 127 |
ModuleNotFoundError: No module named 'torch'
|
|
|
|
| 136 |
|
| 137 |
note: This error originates from a subprocess, and is likely not a problem with pip.
|
| 138 |
|
| 139 |
+
--> ERROR: process "/bin/sh -c pip install --no-cache-dir -r /tmp/requirements.txt" did not complete successfully: exit code: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|