Spaces:
Running on Zero
Running on Zero
[Admin maintenance] Support new ZeroGPU hardware
#5
by multimodalart HF Staff - opened
- README.md +1 -1
- app.py +22 -5
- requirements.txt +16 -0
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🐨
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.20.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
app.py
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
os.system("git clone https://github.com/modelscope/DiffSynth-Studio.git")
|
|
|
|
| 3 |
os.system("cp -r DiffSynth-Studio/diffsynth ./")
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from diffsynth import save_video, ModelManager, SVDVideoPipeline
|
| 6 |
-
|
| 7 |
-
import torch, os, random, time
|
| 8 |
import gradio as gr
|
| 9 |
import numpy as np
|
| 10 |
from PIL import Image
|
| 11 |
-
import spaces
|
| 12 |
|
| 13 |
|
| 14 |
def get_i2v_pipeline():
|
|
@@ -99,7 +116,7 @@ To use this model, please refer to [DiffSynth](https://github.com/modelscope/Dif
|
|
| 99 |
inputs=image,
|
| 100 |
outputs=[video, seed],
|
| 101 |
fn=process_examples,
|
| 102 |
-
cache_examples=
|
| 103 |
)
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import os
|
| 3 |
+
# The 2.0 rewrite of DiffSynth-Studio restructured the package into diffsynth/core/...
|
| 4 |
+
# and dropped ModelManager/SVDVideoPipeline (and requirements.txt), breaking the runtime
|
| 5 |
+
# `git clone` + `pip install -r DiffSynth-Studio/requirements.txt` this Space used to do.
|
| 6 |
+
# Pin the clone to the last pre-2.0 commit. All of DiffSynth's own deps (torch, transformers,
|
| 7 |
+
# huggingface_hub, einops, etc.) are now pinned directly in this Space's requirements.txt and
|
| 8 |
+
# installed at BUILD time, so at runtime we only need to fetch and copy the plain-Python
|
| 9 |
+
# `diffsynth` package itself (no pip install here: `import spaces` above already pulled
|
| 10 |
+
# huggingface_hub into memory, so a runtime `pip install --upgrade` would update the files on
|
| 11 |
+
# disk but not the module object already cached in this process's sys.modules).
|
| 12 |
os.system("git clone https://github.com/modelscope/DiffSynth-Studio.git")
|
| 13 |
+
os.system("cd DiffSynth-Studio && git checkout afd101f3452c9ecae0c87b79adfa2e22d65ffdc3")
|
| 14 |
os.system("cp -r DiffSynth-Studio/diffsynth ./")
|
| 15 |
+
# gradio 6 needs huggingface_hub>=1.2, but this pre-2.0 DiffSynth checkout needs a
|
| 16 |
+
# huggingface_hub new enough to satisfy modern transformers (CachedRepoTreeNotFoundError) --
|
| 17 |
+
# together that only resolves with a 5.x transformers, which dropped the long-deprecated
|
| 18 |
+
# re-export `transformers.modeling_utils.PretrainedConfig` that diffsynth's
|
| 19 |
+
# stepvideo_text_encoder.py still imports. Shim it back before diffsynth is imported.
|
| 20 |
+
import transformers.modeling_utils as _modeling_utils
|
| 21 |
+
from transformers.configuration_utils import PretrainedConfig as _PretrainedConfig
|
| 22 |
+
if not hasattr(_modeling_utils, "PretrainedConfig"):
|
| 23 |
+
_modeling_utils.PretrainedConfig = _PretrainedConfig
|
| 24 |
from diffsynth import save_video, ModelManager, SVDVideoPipeline
|
| 25 |
+
import torch, random, time
|
|
|
|
| 26 |
import gradio as gr
|
| 27 |
import numpy as np
|
| 28 |
from PIL import Image
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
def get_i2v_pipeline():
|
|
|
|
| 116 |
inputs=image,
|
| 117 |
outputs=[video, seed],
|
| 118 |
fn=process_examples,
|
| 119 |
+
cache_examples=False,
|
| 120 |
)
|
| 121 |
|
| 122 |
if __name__ == "__main__":
|
requirements.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch==2.11.0
|
| 2 |
+
torchvision==0.26.0
|
| 3 |
+
huggingface_hub==1.23.0
|
| 4 |
+
transformers
|
| 5 |
+
imageio
|
| 6 |
+
imageio[ffmpeg]
|
| 7 |
+
safetensors
|
| 8 |
+
einops
|
| 9 |
+
sentencepiece
|
| 10 |
+
protobuf
|
| 11 |
+
modelscope
|
| 12 |
+
ftfy
|
| 13 |
+
pynvml
|
| 14 |
+
pandas
|
| 15 |
+
accelerate
|
| 16 |
+
peft
|