mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-06 08:01:27 +00:00
fix aria2c with both download cases
This commit is contained in:
parent
efe546390b
commit
174d00bb74
1 changed files with 13 additions and 11 deletions
24
koboldcpp.py
24
koboldcpp.py
|
|
@ -6505,18 +6505,20 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
|
|||
print(f"{output_filename} already exists, using existing file.")
|
||||
return output_filename
|
||||
print(f"Downloading {input_url}", flush=True)
|
||||
dl_success = False
|
||||
|
||||
dl_success = False
|
||||
out_dir = os.path.dirname(os.path.abspath(output_filename)) or os.getcwd()
|
||||
out_name = os.path.basename(output_filename)
|
||||
try:
|
||||
if os.name == 'nt':
|
||||
basepath = os.path.abspath(os.path.dirname(__file__))
|
||||
a2cexe = (os.path.join(basepath, "aria2c-win.exe"))
|
||||
if os.path.exists(a2cexe): #on windows try using embedded a2cexe
|
||||
out_dir = os.path.dirname(output_filename)
|
||||
out_name = os.path.basename(output_filename)
|
||||
a2cexe = os.path.join(basepath, "aria2c-win.exe")
|
||||
if os.path.exists(a2cexe): # on windows try using embedded aria2c
|
||||
rc = subprocess.run([
|
||||
a2cexe, "-x", "16", "-s", "16", "--summary-interval=15", "--console-log-level=error", "--log-level=error",
|
||||
"--download-result=default", "--continue=true", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3",
|
||||
a2cexe, "-x", "16", "-s", "16",
|
||||
"--summary-interval=15", "--console-log-level=error", "--log-level=error",
|
||||
"--download-result=default", "--continue=true", "--allow-overwrite=true",
|
||||
"--file-allocation=none", "--max-tries=3",
|
||||
"-d", out_dir, "-o", out_name, input_url
|
||||
], capture_output=capture_output, text=True, check=True, encoding='utf-8')
|
||||
dl_success = (rc.returncode == 0 and os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size)
|
||||
|
|
@ -6525,11 +6527,11 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
|
|||
|
||||
try:
|
||||
if not dl_success and shutil.which("aria2c") is not None:
|
||||
out_dir = os.path.dirname(output_filename)
|
||||
out_name = os.path.basename(output_filename)
|
||||
rc = subprocess.run([
|
||||
"aria2c", "-x", "16", "-s", "16", "--summary-interval=15", "--console-log-level=error", "--log-level=error",
|
||||
"--download-result=default", "--allow-overwrite=true", "--file-allocation=none", "--max-tries=3",
|
||||
"aria2c", "-x", "16", "-s", "16",
|
||||
"--summary-interval=15", "--console-log-level=error", "--log-level=error",
|
||||
"--download-result=default", "--allow-overwrite=true",
|
||||
"--file-allocation=none", "--max-tries=3",
|
||||
"-d", out_dir, "-o", out_name, input_url
|
||||
], capture_output=capture_output, text=True, check=True, encoding='utf-8')
|
||||
dl_success = (rc.returncode == 0 and os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue