mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-13 18:47:29 +08:00
Fix vbench download
This commit is contained in:
parent
c02b5d4c1e
commit
28bbdb0031
@ -256,9 +256,8 @@ _WAN22_I2V_GRAPH: dict[str, Any] = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_VBENCH_I2V_JSON_URL = (
|
# Google Drive file IDs from VBench's vbench2_beta_i2v/download_data.sh
|
||||||
"https://raw.githubusercontent.com/Vchitect/VBench/master/vbench2_beta_i2v/i2v-bench-info.json"
|
_VBENCH_ORIGIN_ZIP_GDRIVE_ID = "1qhkLCSBkzll0dkKpwlDTwLL0nxdQ4nrY"
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def download_wan22_models(base_dir: Path) -> None:
|
def download_wan22_models(base_dir: Path) -> None:
|
||||||
@ -275,41 +274,36 @@ def download_wan22_models(base_dir: Path) -> None:
|
|||||||
|
|
||||||
def _try_download_vbench_i2v(input_dir: Path) -> list[str]:
|
def _try_download_vbench_i2v(input_dir: Path) -> list[str]:
|
||||||
"""
|
"""
|
||||||
Attempt to fetch VBench I2V images via huggingface_hub.
|
Download VBench I2V origin images from Google Drive via gdown (pip install gdown).
|
||||||
Returns image basenames placed in *input_dir*, or [] on failure.
|
Returns image basenames placed in *input_dir*, or [] on failure.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from huggingface_hub import snapshot_download # type: ignore
|
import gdown # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("[setup] huggingface_hub not available; skipping VBench download.")
|
print("[setup] gdown not available; skipping VBench download. Install with: pip install gdown")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
zip_path = input_dir / "origin.zip"
|
||||||
try:
|
try:
|
||||||
print("[setup] downloading Vchitect/VBench_I2V dataset from HuggingFace ...")
|
if not zip_path.exists():
|
||||||
cache_dir = input_dir / "_vbench_cache"
|
print("[setup] downloading VBench I2V origin images from Google Drive ...")
|
||||||
local = snapshot_download(
|
gdown.download(id=_VBENCH_ORIGIN_ZIP_GDRIVE_ID, output=str(zip_path), quiet=False)
|
||||||
repo_id="Vchitect/VBench_I2V",
|
print("[setup] extracting origin.zip ...")
|
||||||
repo_type="dataset",
|
with zipfile.ZipFile(zip_path, "r") as zf:
|
||||||
local_dir=str(cache_dir),
|
zf.extractall(str(input_dir))
|
||||||
)
|
zip_path.unlink()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(f"[setup] VBench I2V download failed: {exc}")
|
print(f"[setup] VBench I2V download failed: {exc}")
|
||||||
|
if zip_path.exists():
|
||||||
|
zip_path.unlink()
|
||||||
return []
|
return []
|
||||||
|
|
||||||
image_exts = {".png", ".jpg", ".jpeg", ".webp"}
|
image_exts = {".png", ".jpg", ".jpeg", ".webp"}
|
||||||
found = sorted(p for p in Path(local).rglob("*") if p.suffix.lower() in image_exts)
|
filenames = sorted(
|
||||||
if not found:
|
p.name for p in input_dir.rglob("*") if p.suffix.lower() in image_exts
|
||||||
return []
|
)
|
||||||
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
filenames: list[str] = []
|
|
||||||
for src in found:
|
|
||||||
dest = input_dir / src.name
|
|
||||||
if not dest.exists():
|
|
||||||
shutil.copy2(str(src), str(dest))
|
|
||||||
filenames.append(src.name)
|
|
||||||
|
|
||||||
print(f"[setup] prepared {len(filenames)} VBench I2V images in {input_dir}")
|
print(f"[setup] prepared {len(filenames)} VBench I2V images in {input_dir}")
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user