Download code/scripts/download_metadata.py from CollinMa/nextgpt-chapter6-report: direct link, hf CLI and curl.
- Browser
- Download file 915 Bytes
-
https://huggingface.co/spaces/CollinMa/nextgpt-chapter6-report/resolve/main/code/scripts/download_metadata.py
- Command line
-
hf download hf://spaces/CollinMa/nextgpt-chapter6-report/code/scripts/download_metadata.py
-
curl -L -o download_metadata.py https://huggingface.co/spaces/CollinMa/nextgpt-chapter6-report/resolve/main/code/scripts/download_metadata.py
915 Bytes
| """Fetch small tokenizer/index files before the large checkpoint transfers finish.""" | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT)) | |
| from settings import WEIGHTS, MODELS | |
| from huggingface_hub import HfApi | |
| from range_download import download | |
| if __name__ == '__main__': | |
| for key in ('llama','vicuna_delta'): | |
| repo, revision = MODELS[key] | |
| target = WEIGHTS/'sources'/key | |
| for file in HfApi().model_info(repo,revision=revision,files_metadata=True).siblings: | |
| if file.size > 2_000_000 or not file.rfilename.endswith(('.json','.model')): | |
| continue | |
| download(f'https://huggingface.co/{repo}/resolve/{revision}/{file.rfilename}', | |
| target/file.rfilename,file.size,sha256=file.lfs.sha256 if file.lfs else None, | |
| git_sha1=file.blob_id if not file.lfs else None) | |