Commit ·
6d556cb
1
Parent(s): 15ab81a
Pre-download CLAP model at startup to fix daemonic process error in ZeroGPU
Browse filesClapTextModelWithProjection.from_pretrained() internally spawns a child
process for safe-tensor conversion, which fails inside ZeroGPU's daemonic
worker. Pre-downloading laion/larger_clap_general via snapshot_download()
at module level ensures weights are cached before GPU function runs.
app.py
CHANGED
|
@@ -21,7 +21,7 @@ import soundfile as sf
|
|
| 21 |
import ffmpeg
|
| 22 |
import spaces
|
| 23 |
import gradio as gr
|
| 24 |
-
from huggingface_hub import hf_hub_download
|
| 25 |
|
| 26 |
# ================================================================== #
|
| 27 |
# CHECKPOINT CONFIGURATION #
|
|
@@ -62,6 +62,12 @@ hf_hub_download(repo_id=CKPT_REPO_ID, filename="HunyuanVideo-Foley/vae_128d_48k.
|
|
| 62 |
hf_hub_download(repo_id=CKPT_REPO_ID, filename="HunyuanVideo-Foley/synchformer_state_dict.pth", cache_dir=CACHE_DIR, local_dir=str(HUNYUAN_MODEL_DIR), local_dir_use_symlinks=False)
|
| 63 |
print("HunyuanVideoFoley checkpoints downloaded.")
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
# ================================================================== #
|
| 66 |
# SHARED CONSTANTS / HELPERS #
|
| 67 |
# ================================================================== #
|
|
|
|
| 21 |
import ffmpeg
|
| 22 |
import spaces
|
| 23 |
import gradio as gr
|
| 24 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 25 |
|
| 26 |
# ================================================================== #
|
| 27 |
# CHECKPOINT CONFIGURATION #
|
|
|
|
| 62 |
hf_hub_download(repo_id=CKPT_REPO_ID, filename="HunyuanVideo-Foley/synchformer_state_dict.pth", cache_dir=CACHE_DIR, local_dir=str(HUNYUAN_MODEL_DIR), local_dir_use_symlinks=False)
|
| 63 |
print("HunyuanVideoFoley checkpoints downloaded.")
|
| 64 |
|
| 65 |
+
# Pre-download CLAP model so from_pretrained() reads local cache inside the
|
| 66 |
+
# ZeroGPU daemonic worker (spawning child processes there is not allowed).
|
| 67 |
+
print("Pre-downloading CLAP model (laion/larger_clap_general)…")
|
| 68 |
+
snapshot_download(repo_id="laion/larger_clap_general")
|
| 69 |
+
print("CLAP model pre-downloaded.")
|
| 70 |
+
|
| 71 |
# ================================================================== #
|
| 72 |
# SHARED CONSTANTS / HELPERS #
|
| 73 |
# ================================================================== #
|