bowmanchow commited on
Commit
461fa16
·
1 Parent(s): ea0a063

change download method

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -1418,19 +1418,16 @@ def create_ui(
1418
 
1419
 
1420
  def download_required_files():
1421
- import subprocess
 
1422
 
1423
- # 1. Download "checkpoints" directory from huggingface.co/gdhe17/Self-Forcing
1424
  if not os.path.exists("checkpoints"):
1425
  print("Downloading checkpoints from gdhe17/Self-Forcing...")
1426
- subprocess.run(
1427
- [
1428
- "huggingface-cli", "download",
1429
- "gdhe17/Self-Forcing",
1430
- "--include", "checkpoints/*",
1431
- "--local-dir", ".",
1432
- ],
1433
- check=True,
1434
  )
1435
 
1436
  # 2. Download Wan-AI/Wan2.1-T2V-1.3B and place in wan_models/Wan2.1-T2V-1.3B
@@ -1438,20 +1435,15 @@ def download_required_files():
1438
  if not os.path.exists(wan_model_dir):
1439
  print("Downloading Wan-AI/Wan2.1-T2V-1.3B...")
1440
  os.makedirs("wan_models", exist_ok=True)
1441
- subprocess.run(
1442
- [
1443
- "huggingface-cli", "download",
1444
- "Wan-AI/Wan2.1-T2V-1.3B",
1445
- "--local-dir", wan_model_dir,
1446
- ],
1447
- check=True,
1448
  )
1449
 
1450
  # 3. Download SAM ViT-H checkpoint
1451
  sam_checkpoint_path = "sam_vit_h_4b8939.pth"
1452
  if not os.path.exists(sam_checkpoint_path):
1453
  print("Downloading SAM ViT-H checkpoint...")
1454
- import urllib.request
1455
  urllib.request.urlretrieve(
1456
  "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
1457
  sam_checkpoint_path,
 
1418
 
1419
 
1420
  def download_required_files():
1421
+ from huggingface_hub import snapshot_download
1422
+ import urllib.request
1423
 
1424
+ # 1. Download "checkpoints" directory from gdhe17/Self-Forcing
1425
  if not os.path.exists("checkpoints"):
1426
  print("Downloading checkpoints from gdhe17/Self-Forcing...")
1427
+ snapshot_download(
1428
+ repo_id="gdhe17/Self-Forcing",
1429
+ allow_patterns=["checkpoints/*"],
1430
+ local_dir=".",
 
 
 
 
1431
  )
1432
 
1433
  # 2. Download Wan-AI/Wan2.1-T2V-1.3B and place in wan_models/Wan2.1-T2V-1.3B
 
1435
  if not os.path.exists(wan_model_dir):
1436
  print("Downloading Wan-AI/Wan2.1-T2V-1.3B...")
1437
  os.makedirs("wan_models", exist_ok=True)
1438
+ snapshot_download(
1439
+ repo_id="Wan-AI/Wan2.1-T2V-1.3B",
1440
+ local_dir=wan_model_dir,
 
 
 
 
1441
  )
1442
 
1443
  # 3. Download SAM ViT-H checkpoint
1444
  sam_checkpoint_path = "sam_vit_h_4b8939.pth"
1445
  if not os.path.exists(sam_checkpoint_path):
1446
  print("Downloading SAM ViT-H checkpoint...")
 
1447
  urllib.request.urlretrieve(
1448
  "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
1449
  sam_checkpoint_path,