Colab Fix

This commit is contained in:
ebolam
2022-09-19 09:40:49 -04:00
parent cb5204731c
commit 1a31e0994c
2 changed files with 5 additions and 6 deletions

View File

@@ -502,7 +502,7 @@ class model_settings(settings):
self.tqdm_progress = 0
else:
self.tqdm.update(value-old_value)
self.tqdm_progress = round(float(self.downloaded_chunks)/float(self.total_download_chunks)*100, 1)
self.tqdm_progress = 0 if self.total_download_chunks==0 else round(float(self.downloaded_chunks)/float(self.total_download_chunks)*100, 1)
if self.tqdm.format_dict['rate'] is not None:
self.tqdm_rem_time = str(datetime.timedelta(seconds=int(float(self.total_download_chunks-self.downloaded_chunks)/self.tqdm.format_dict['rate'])))

View File

@@ -212,10 +212,6 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str =
p.terminate()
done = True
break
if bar is None:
bar = tqdm(total=total_length, desc=f"[aria2] Downloading model", unit="B", unit_scale=True, unit_divisor=1000)
koboldai_vars.total_download_chunks = total_length
visited = set()
for x in r:
filename = x["files"][0]["path"]
lengths[filename] = (int(x["completedLength"]), int(x["totalLength"]))
@@ -223,8 +219,11 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str =
for k, v in lengths.items():
if k not in visited:
lengths[k] = (v[1], v[1])
if bar is None:
bar = tqdm(total=total_length, desc=f"[aria2] Downloading model", unit="B", unit_scale=True, unit_divisor=1000)
koboldai_vars.total_download_chunks = sum(v[1] for v in lengths.values())
visited = set()
koboldai_vars.downloaded_chunks = sum(v[0] for v in lengths.values())
koboldai_vars.total_download_chunks = sum(v[1] for v in lengths.values())
bar.n = koboldai_vars.downloaded_chunks
bar.update()
time.sleep(0.1)