Fix download script (#1373)
This commit is contained in:
parent
49aa05054a
commit
69d50e2e86
1 changed files with 5 additions and 2 deletions
|
@ -81,7 +81,7 @@ def sanitize_model_and_branch_names(model, branch):
|
||||||
|
|
||||||
def get_download_links_from_huggingface(model, branch, text_only=False):
|
def get_download_links_from_huggingface(model, branch, text_only=False):
|
||||||
base = "https://huggingface.co"
|
base = "https://huggingface.co"
|
||||||
page = f"/api/models/{model}/tree/{branch}?cursor="
|
page = f"/api/models/{model}/tree/{branch}"
|
||||||
cursor = b""
|
cursor = b""
|
||||||
|
|
||||||
links = []
|
links = []
|
||||||
|
@ -93,7 +93,10 @@ def get_download_links_from_huggingface(model, branch, text_only=False):
|
||||||
has_safetensors = False
|
has_safetensors = False
|
||||||
is_lora = False
|
is_lora = False
|
||||||
while True:
|
while True:
|
||||||
content = requests.get(f"{base}{page}{cursor.decode()}").content
|
url = f"{base}{page}" + (f"?cursor={cursor.decode()}" if cursor else "")
|
||||||
|
r = requests.get(url)
|
||||||
|
r.raise_for_status()
|
||||||
|
content = r.content
|
||||||
|
|
||||||
dict = json.loads(content)
|
dict = json.loads(content)
|
||||||
if len(dict) == 0:
|
if len(dict) == 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue