Aria2 Status Bar Download Fix

This commit is contained in:
ebolam 2022-08-19 12:13:46 -04:00
parent 10c46340f7
commit 8ba68e05ec

View File

@ -176,9 +176,8 @@ from flask_socketio import emit
class Send_to_socketio(object): class Send_to_socketio(object):
def write(self, bar): def write(self, bar):
time.sleep(0.01) time.sleep(0.01)
print("got bar data")
try: try:
print("Bar data: {}".format(bar)) print(bar)
emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True) emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True)
except: except:
pass pass
@ -279,7 +278,6 @@ def aria2_hook(pretrained_model_name_or_path: str, force_download=False, cache_d
done = True done = True
break break
if bar is None: if bar is None:
print("setting up status bar for aria2 download")
bar = tqdm(total=total_length, desc=f"[aria2] Downloading model", unit="B", unit_scale=True, unit_divisor=1000, file=Send_to_socketio()) bar = tqdm(total=total_length, desc=f"[aria2] Downloading model", unit="B", unit_scale=True, unit_divisor=1000, file=Send_to_socketio())
visited = set() visited = set()
for x in r: for x in r: