Download code/hf_push.py from ThuongBuiRVC/datariengcuathuongbui: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/datasets/ThuongBuiRVC/datariengcuathuongbui/resolve/main/code/hf_push.py
- Command line
-
hf download hf://datasets/ThuongBuiRVC/datariengcuathuongbui/code/hf_push.py
-
curl -L -o hf_push.py https://huggingface.co/datasets/ThuongBuiRVC/datariengcuathuongbui/resolve/main/code/hf_push.py
2.08 kB
| """push everything training needs to the private HF dataset repos (resumable: upload_large_folder keeps its state).""" | |
| import os | |
| import time | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| api = HfApi(token=os.environ['HF_TOKEN']) | |
| ME = 'ThuongBuiRVC' | |
| REPO, CLIPS = f'{ME}/vlr-latents', f'{ME}/vlr-val-clips' | |
| V = Path('/mnt/10TB_HDD/nuReasoning/vlr') | |
| CODE = Path('/home/db/ThuongBui/localization/vlr') | |
| DATA = ['train.pkl', 'val.pkl', 'train_supp.pkl', 'val_off.pkl', 'test.pkl', 'test_extra.pkl', 'crit_train.pkl', 'crit_val.pkl', | |
| 'crit_val_off.pkl', 'crit_train_supp.pkl', 'ego_fut_v2.pkl', 'submission_template.json'] | |
| t0 = time.time() | |
| NW = int(os.environ.get('NW', '8')) | |
| if not os.environ.get('SKIP_SMALL'): | |
| print('data', sum((V / 'data' / f).stat().st_size for f in DATA) / 1e9, 'GB', flush=True) | |
| api.upload_folder(folder_path=str(V / 'data'), path_in_repo='data', repo_id=REPO, repo_type='dataset', allow_patterns=DATA, | |
| commit_message='records, labels, ego futures, submission template') | |
| api.upload_folder(folder_path=str(CODE), path_in_repo='code', repo_id=REPO, repo_type='dataset', allow_patterns=['*.py', '*.sh'], | |
| commit_message='VLR code') | |
| api.upload_file(path_or_fileobj=str(CODE / 'runs/joint_r1/last.pt'), path_in_repo='ckpt/joint_r1_last.pt', repo_id=REPO, | |
| repo_type='dataset', commit_message='init checkpoint (joint_r1 epoch 1)') | |
| print(f'small files done {time.time() - t0:.0f} s', flush=True) | |
| api.upload_large_folder(repo_id=REPO, folder_path=str(V), repo_type='dataset', allow_patterns=['cache/*/*.npz'], num_workers=NW) | |
| print(f'latents done {(time.time() - t0) / 3600:.2f} h', flush=True) | |
| api.create_repo(CLIPS, repo_type='dataset', private=True, exist_ok=True) | |
| api.upload_large_folder(repo_id=CLIPS, folder_path='/mnt/10TB_HDD/nuReasoning/data_val_official', repo_type='dataset', | |
| allow_patterns=['*/metadata.json', '*/map.pkl', '*/ego_state/*.pkl', '*/annotations/*.pkl'], num_workers=NW) | |
| print(f'ALL_DONE {(time.time() - t0) / 3600:.2f} h', flush=True) | |