From d1c56bc6b854a85baab86385f5aef7b36737def0 Mon Sep 17 00:00:00 2001 From: ebolam Date: Mon, 19 Sep 2022 09:28:33 -0400 Subject: [PATCH] Colab Fix --- utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index 661d2bbd..ad4f2b7a 100644 --- a/utils.py +++ b/utils.py @@ -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): import transformers lengths = {} + path = None s = requests.Session() s.mount("http://", requests.adapters.HTTPAdapter(max_retries=requests.adapters.Retry(total=120, backoff_factor=1))) bar = None @@ -232,8 +233,9 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str = raise e finally: try: - if os.path.exists(path): - os.remove(path) + if path is not None: + if os.path.exists(path): + os.remove(path) except OSError: pass code = p.wait()