File size: 1,477 Bytes
7245cc5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from huggingface_hub import snapshot_download
import os
import sys
# Make sure HF_TOKEN is set in your env beforehand:
# export HF_TOKEN=your_hf_token
#get first command line argument


mode = sys.argv[1] if len(sys.argv) > 1 else "outsidephotos"


REPO_ID = "tedlasai/blur2vid"
REPO_TYPE = "model"

# These are the subfolders you previously used as path_in_repo
if mode == "outsidephotos":
    checkpoints = [
        "cogvideox-outsidephotos",
    ]
elif mode == "gopro":
    checkpoints = [
        "cogvideox-gopro-test",
        "cogvideox-gopro-2x-test",
    ]
elif mode == "baist":
    checkpoints = [
        "cogvideox-baist-test",
    ]
elif mode == "full":
    checkpoints = [
        "cogvideox-baist-test",
        "cogvideox-gopro-test",
        "cogvideox-gopro-2x-test",
        "cogvideox-full-test",
        "cogvideox-outsidephotos",
    ]

# This is the root local directory where you want everything saved
#get path of this file
LOCAL_TRAINING_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "training")
os.makedirs(LOCAL_TRAINING_ROOT, exist_ok=True)

# Download only those folders from the repo and place them under LOCAL_TRAINING_ROOT
snapshot_download(
    repo_id=REPO_ID,
    repo_type=REPO_TYPE,
    local_dir=LOCAL_TRAINING_ROOT,
    local_dir_use_symlinks=False,
    allow_patterns=[f"{name}/*" for name in checkpoints],
    token=os.getenv("HF_TOKEN"),
)

print(f"Done! Checkpoints downloaded under: {LOCAL_TRAINING_ROOT}")