mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Downloader: handle one more retry case after 5770e06c48
This commit is contained in:
parent
cb31998605
commit
0b193b8553
@ -190,17 +190,17 @@ class ModelDownloader:
|
|||||||
headers = {}
|
headers = {}
|
||||||
mode = 'wb'
|
mode = 'wb'
|
||||||
|
|
||||||
if output_path.exists() and not start_from_scratch:
|
|
||||||
# Resume download
|
|
||||||
r = session.get(url, stream=True, timeout=20)
|
|
||||||
total_size = int(r.headers.get('content-length', 0))
|
|
||||||
if output_path.stat().st_size >= total_size:
|
|
||||||
return
|
|
||||||
|
|
||||||
headers = {'Range': f'bytes={output_path.stat().st_size}-'}
|
|
||||||
mode = 'ab'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if output_path.exists() and not start_from_scratch:
|
||||||
|
# Resume download
|
||||||
|
r = session.get(url, stream=True, timeout=20)
|
||||||
|
total_size = int(r.headers.get('content-length', 0))
|
||||||
|
if output_path.stat().st_size >= total_size:
|
||||||
|
return
|
||||||
|
|
||||||
|
headers = {'Range': f'bytes={output_path.stat().st_size}-'}
|
||||||
|
mode = 'ab'
|
||||||
|
|
||||||
with session.get(url, stream=True, headers=headers, timeout=30) as r:
|
with session.get(url, stream=True, headers=headers, timeout=30) as r:
|
||||||
r.raise_for_status() # If status is not 2xx, raise an error
|
r.raise_for_status() # If status is not 2xx, raise an error
|
||||||
total_size = int(r.headers.get('content-length', 0))
|
total_size = int(r.headers.get('content-length', 0))
|
||||||
|
Loading…
Reference in New Issue
Block a user