mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-20 05:30:57 +01:00
Merge pull request #127 from VE-FORBRYDERNE/aria2
Handle aria2 properly when it exits with nonzero exit code
This commit is contained in:
commit
a1c7017ddc
3
utils.py
3
utils.py
@ -218,6 +218,9 @@ def aria2_hook(pretrained_model_name_or_path: str, force_download=False, cache_d
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
code = p.wait()
|
||||||
|
if code:
|
||||||
|
raise OSError(f"aria2 exited with exit code {code}")
|
||||||
for u, t, n in zip(urls, etags, filenames):
|
for u, t, n in zip(urls, etags, filenames):
|
||||||
os.rename(os.path.join(_cache_dir, "kai-tempfile." + n), os.path.join(_cache_dir, n))
|
os.rename(os.path.join(_cache_dir, "kai-tempfile." + n), os.path.join(_cache_dir, n))
|
||||||
with open(os.path.join(_cache_dir, n + ".json"), "w") as f:
|
with open(os.path.join(_cache_dir, n + ".json"), "w") as f:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user