Colab Fix

This commit is contained in:
ebolam
2022-09-19 09:28:33 -04:00
parent f5ce00622b
commit d1c56bc6b8

View File

@@ -190,6 +190,7 @@ class Send_to_socketio(object):
def _download_with_aria2(aria2_config: str, total_length: int, directory: str = ".", user_agent=None, force_download=False, use_auth_token=None): def _download_with_aria2(aria2_config: str, total_length: int, directory: str = ".", user_agent=None, force_download=False, use_auth_token=None):
import transformers import transformers
lengths = {} lengths = {}
path = None
s = requests.Session() s = requests.Session()
s.mount("http://", requests.adapters.HTTPAdapter(max_retries=requests.adapters.Retry(total=120, backoff_factor=1))) s.mount("http://", requests.adapters.HTTPAdapter(max_retries=requests.adapters.Retry(total=120, backoff_factor=1)))
bar = None bar = None
@@ -232,8 +233,9 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str =
raise e raise e
finally: finally:
try: try:
if os.path.exists(path): if path is not None:
os.remove(path) if os.path.exists(path):
os.remove(path)
except OSError: except OSError:
pass pass
code = p.wait() code = p.wait()