Spaces:
Sleeping
Sleeping
Upload download.py
Browse files- download.py +32 -0
download.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
from huggingface_hub import snapshot_download, hf_hub_download
|
4 |
+
|
5 |
+
def download_from_hf_hub(repo_id, local_dir, use_auth_token, filename=None):
|
6 |
+
if filename is not None:
|
7 |
+
res = hf_hub_download(repo_id=repo_id, filename=filename, local_dir=local_dir, use_auth_token=use_auth_token, local_dir_use_symlinks=False)
|
8 |
+
else:
|
9 |
+
res = snapshot_download(repo_id=repo_id, local_dir=local_dir, use_auth_token=use_auth_token, local_dir_use_symlinks=False, ignore_patterns=["*.safetensors"])
|
10 |
+
return res
|
11 |
+
|
12 |
+
|
13 |
+
if __name__ == "__main__":
|
14 |
+
use_auth_token = "xxx" # replace "xxx" with your access token (see https://huggingface.co/docs/hub/security-tokens and https://huggingface.co/settings/tokens)
|
15 |
+
|
16 |
+
## repo_id = "microsoft/phi-2"
|
17 |
+
## local_dir = "C:/OneDrive/Desktop/HKU-DASC7606-A2-main/download/phi-1_5"
|
18 |
+
|
19 |
+
repo_id = "meta-llama/Meta-Llama-3-8B" # "meta-llama/Meta-Llama-3-70B"
|
20 |
+
local_dir = "C:/OneDrive/git/ARIN_7102/download/Llama-3-8B" # replace "xxx" with a real path and make sure that it has at least 3G of space
|
21 |
+
|
22 |
+
download_from_hf_hub(repo_id=repo_id, use_auth_token=use_auth_token, local_dir=local_dir)
|
23 |
+
|
24 |
+
'''
|
25 |
+
## repo_id = "BAAI/bge-small-en-v1.5"
|
26 |
+
## local_dir = "xxx/bge-small-en-v1.5"
|
27 |
+
|
28 |
+
repo_id = "BAAI/bge-small-en-v1.5"
|
29 |
+
local_dir = "C:/OneDrive/git/ARIN_7102/download/bge-small-en-v1.5"
|
30 |
+
|
31 |
+
download_from_hf_hub(repo_id=repo_id, use_auth_token=use_auth_token, local_dir=local_dir)
|
32 |
+
'''
|