File size: 2,562 Bytes
08db8da
 
 
 
 
 
 
 
cd89c37
5a67d3e
 
08db8da
 
 
65bf068
08db8da
65bf068
08db8da
10ff2d6
08db8da
10ff2d6
08db8da
 
10ff2d6
08db8da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
import os
import joblib
from huggingface_hub import hf_hub_download
access_token_smpl = os.environ.get('HF_SMPL_TOKEN')

def get_smpl_models():
    REPO_ID = 'athn-nik/smpl_models'
    from huggingface_hub import snapshot_download
    print(access_token_smpl)
    # aaa = hf_hub_download(REPO_ID, filename="smplh/SMPLH_NEUTRAL.npz")
    # print(aaa)
    return snapshot_download(repo_id=REPO_ID, allow_patterns="smplh*",
                             token=access_token_smpl)

def download_models(ckpt_to_dl):
    REPO_ID = 'athn-nik/example-model'
    return hf_hub_download(REPO_ID, filename=f"{ckpt_to_dl}.ckpt")

def download_model_config(config_name):
    REPO_ID = 'athn-nik/example-model'
    path_to_config = hf_hub_download(REPO_ID, filename=f"{config_name}/.hydra/config.yaml")
    from omegaconf import OmegaConf
    model_cfg = OmegaConf.load(path_to_config)
    return model_cfg

def download_motion_from_dataset(key_to_dl):
    REPO_ID = 'athn-nik/example-model'
    from huggingface_hub import snapshot_download
    keytodl = key_to_dl
    keytodl = '000008'
    path_for_ds = snapshot_download(repo_id=REPO_ID, 
                                           allow_patterns=f"dataset_inputs/{keytodl}",
                                           token=access_token_smpl)
    path_for_ds_sample = path_for_ds + f'/dataset_inputs/{keytodl}.pth.tar'
    return path_for_ds_sample

def download_tmr():
    REPO_ID = 'athn-nik/example-model'
    # return hf_hub_download(REPO_ID, filename="min_checkpoint.ckpt")
    from huggingface_hub import snapshot_download
    return snapshot_download(repo_id=REPO_ID, allow_patterns="tmr*",
                             token=access_token_smpl)

def download_motionfix():
    REPO_ID = 'athn-nik/example-model'
    # return hf_hub_download(REPO_ID, filename="min_checkpoint.ckpt")
    from huggingface_hub import snapshot_download
    return snapshot_download(repo_id=REPO_ID, allow_patterns="motionfix*",
                             token=access_token_smpl)

def download_motionfix_dataset():
    REPO_ID = 'athn-nik/example-model'
    dataset_downloaded_path = hf_hub_download(REPO_ID, filename="motionfix.pth.tar")
    dataset_dict = joblib.load(dataset_downloaded_path)
    return dataset_dict

def download_embeddings():
    REPO_ID = 'athn-nik/example-model'
    # return hf_hub_download(REPO_ID, filename="min_checkpoint.ckpt")
    from huggingface_hub import snapshot_download
    return snapshot_download(repo_id=REPO_ID, allow_patterns="embeddings*",
                             token=access_token_smpl)