Spaces:
Build error
Build error
Update download-model.py
Browse files- download-model.py +6 -3
download-model.py
CHANGED
@@ -94,7 +94,7 @@ facebook/opt-1.3b
|
|
94 |
|
95 |
def get_download_links_from_huggingface(model, branch):
|
96 |
base = "https://huggingface.co"
|
97 |
-
page = f"/api/models/{model}/tree/{branch}
|
98 |
cursor = b""
|
99 |
|
100 |
links = []
|
@@ -102,8 +102,11 @@ def get_download_links_from_huggingface(model, branch):
|
|
102 |
has_pytorch = False
|
103 |
has_safetensors = False
|
104 |
while True:
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
107 |
dict = json.loads(content)
|
108 |
if len(dict) == 0:
|
109 |
break
|
|
|
94 |
|
95 |
def get_download_links_from_huggingface(model, branch):
|
96 |
base = "https://huggingface.co"
|
97 |
+
page = f"/api/models/{model}/tree/{branch}"
|
98 |
cursor = b""
|
99 |
|
100 |
links = []
|
|
|
102 |
has_pytorch = False
|
103 |
has_safetensors = False
|
104 |
while True:
|
105 |
+
url = f"{base}{page}" + (f"?cursor={cursor.decode()}" if cursor else "")
|
106 |
+
r = requests.get(url)
|
107 |
+
r.raise_for_status()
|
108 |
+
content = r.content
|
109 |
+
|
110 |
dict = json.loads(content)
|
111 |
if len(dict) == 0:
|
112 |
break
|