mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix
This commit is contained in:
10
aiserver.py
10
aiserver.py
@@ -1618,8 +1618,8 @@ def get_cluster_models(msg):
|
|||||||
# If the client settings file doesn't exist, create it
|
# If the client settings file doesn't exist, create it
|
||||||
# Write API key to file
|
# Write API key to file
|
||||||
os.makedirs('settings', exist_ok=True)
|
os.makedirs('settings', exist_ok=True)
|
||||||
if path.exists(get_config_filename(koboldai_vars.model_selected)):
|
if path.exists(get_config_filename(model)):
|
||||||
with open(get_config_filename(koboldai_vars.model_selected), "r") as file:
|
with open(get_config_filename(model), "r") as file:
|
||||||
js = json.load(file)
|
js = json.load(file)
|
||||||
if 'online_model' in js:
|
if 'online_model' in js:
|
||||||
online_model = js['online_model']
|
online_model = js['online_model']
|
||||||
@@ -1630,7 +1630,7 @@ def get_cluster_models(msg):
|
|||||||
changed=True
|
changed=True
|
||||||
if changed:
|
if changed:
|
||||||
js={}
|
js={}
|
||||||
with open(get_config_filename(koboldai_vars.model_selected), "w") as file:
|
with open(get_config_filename(model), "w") as file:
|
||||||
js["apikey"] = koboldai_vars.oaiapikey
|
js["apikey"] = koboldai_vars.oaiapikey
|
||||||
file.write(json.dumps(js, indent=3))
|
file.write(json.dumps(js, indent=3))
|
||||||
|
|
||||||
@@ -1674,7 +1674,7 @@ def patch_transformers_download():
|
|||||||
|
|
||||||
if bar != "":
|
if bar != "":
|
||||||
try:
|
try:
|
||||||
print(bar, end="\r")
|
print(bar, end="")
|
||||||
emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1")
|
emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1")
|
||||||
eventlet.sleep(seconds=0)
|
eventlet.sleep(seconds=0)
|
||||||
except:
|
except:
|
||||||
@@ -1712,10 +1712,12 @@ def patch_transformers_download():
|
|||||||
desc=f"Downloading {file_name}" if file_name is not None else "Downloading",
|
desc=f"Downloading {file_name}" if file_name is not None else "Downloading",
|
||||||
file=Send_to_socketio(),
|
file=Send_to_socketio(),
|
||||||
)
|
)
|
||||||
|
koboldai_vars.total_download_chunks = total
|
||||||
for chunk in r.iter_content(chunk_size=1024):
|
for chunk in r.iter_content(chunk_size=1024):
|
||||||
if chunk: # filter out keep-alive new chunks
|
if chunk: # filter out keep-alive new chunks
|
||||||
if url[-11:] != 'config.json':
|
if url[-11:] != 'config.json':
|
||||||
progress.update(len(chunk))
|
progress.update(len(chunk))
|
||||||
|
koboldai_vars.downloaded_chunks += len(chunk)
|
||||||
temp_file.write(chunk)
|
temp_file.write(chunk)
|
||||||
if url[-11:] != 'config.json':
|
if url[-11:] != 'config.json':
|
||||||
progress.close()
|
progress.close()
|
||||||
|
@@ -493,6 +493,9 @@ class model_settings(settings):
|
|||||||
if self.tqdm.format_dict['rate'] is not None:
|
if self.tqdm.format_dict['rate'] is not None:
|
||||||
self.tqdm_rem_time = str(datetime.timedelta(seconds=int(float(self.total_layers-self.loaded_layers)/self.tqdm.format_dict['rate'])))
|
self.tqdm_rem_time = str(datetime.timedelta(seconds=int(float(self.total_layers-self.loaded_layers)/self.tqdm.format_dict['rate'])))
|
||||||
#Setup TQDP for model downloading
|
#Setup TQDP for model downloading
|
||||||
|
elif name == "total_download_chunks" and 'tqdm' in self.__dict__:
|
||||||
|
self.tqdm.reset(total=value)
|
||||||
|
self.tqdm_progress = 0
|
||||||
elif name == "downloaded_chunks" and 'tqdm' in self.__dict__:
|
elif name == "downloaded_chunks" and 'tqdm' in self.__dict__:
|
||||||
if value == 0:
|
if value == 0:
|
||||||
self.tqdm.reset(total=self.total_download_chunks)
|
self.tqdm.reset(total=self.total_download_chunks)
|
||||||
|
6
utils.py
6
utils.py
@@ -211,7 +211,8 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str =
|
|||||||
done = True
|
done = True
|
||||||
break
|
break
|
||||||
if bar is None:
|
if bar is None:
|
||||||
bar = tqdm(total=total_length, desc=f"[aria2] Downloading model", unit="B", unit_scale=True, unit_divisor=1000)
|
bar = tqdm.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()
|
visited = set()
|
||||||
for x in r:
|
for x in r:
|
||||||
filename = x["files"][0]["path"]
|
filename = x["files"][0]["path"]
|
||||||
@@ -220,7 +221,8 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str =
|
|||||||
for k, v in lengths.items():
|
for k, v in lengths.items():
|
||||||
if k not in visited:
|
if k not in visited:
|
||||||
lengths[k] = (v[1], v[1])
|
lengths[k] = (v[1], v[1])
|
||||||
bar.n = sum(v[0] for v in lengths.values())
|
koboldai_vars.downloaded_chunks = sum(v[0] for v in lengths.values())
|
||||||
|
bar.n = koboldai_vars.downloaded_chunks
|
||||||
bar.update()
|
bar.update()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
path = f.name
|
path = f.name
|
||||||
|
Reference in New Issue
Block a user