mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Downloader: Gracefully handle '416 Range Not Satisfiable' when continuing downloads
This commit is contained in:
parent
0f3793d608
commit
1aa2b924d2
|
|
@ -255,6 +255,11 @@ class ModelDownloader:
|
||||||
mode = 'ab'
|
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:
|
||||||
|
# Assume error 416 (range unsatisfiable) means the download is complete.
|
||||||
|
# Small size differences can happen in Git LFS
|
||||||
|
if mode == 'ab' and r.status_code == 416:
|
||||||
|
break
|
||||||
|
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
total_size_from_stream = int(r.headers.get('content-length', 0))
|
total_size_from_stream = int(r.headers.get('content-length', 0))
|
||||||
if mode == 'ab':
|
if mode == 'ab':
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue