added log output for custom launch
Browse files- modules/model_loader.py +5 -1
modules/model_loader.py
CHANGED
@@ -55,7 +55,7 @@ try:
|
|
55 |
from tqdm import tqdm # If tqdm is installed use it, otherwise use the fake wrapper
|
56 |
except ImportError:
|
57 |
tqdm = _Faketqdm
|
58 |
-
|
59 |
def load_file_from_url(
|
60 |
url: str,
|
61 |
*,
|
@@ -121,6 +121,7 @@ def proxy_download_url_to_file(url: str, dst: str, hash_prefix: Optional[str] =
|
|
121 |
# We deliberately do not use NamedTemporaryFile to avoid restrictive
|
122 |
# file permissions being applied to the downloaded file.
|
123 |
dst = os.path.expanduser(dst)
|
|
|
124 |
for seq in range(tempfile.TMP_MAX):
|
125 |
tmp_dst = dst + '.' + uuid.uuid4().hex + '.partial'
|
126 |
try:
|
@@ -146,12 +147,15 @@ def proxy_download_url_to_file(url: str, dst: str, hash_prefix: Optional[str] =
|
|
146 |
pbar.update(len(buffer))
|
147 |
|
148 |
f.close()
|
|
|
149 |
if hash_prefix is not None:
|
150 |
digest = sha256.hexdigest()
|
151 |
if digest[:len(hash_prefix)] != hash_prefix:
|
152 |
raise RuntimeError(f'invalid hash value (expected "{hash_prefix}", got "{digest}")')
|
153 |
shutil.move(f.name, dst)
|
|
|
154 |
finally:
|
|
|
155 |
f.close()
|
156 |
if os.path.exists(f.name):
|
157 |
os.remove(f.name)
|
|
|
55 |
from tqdm import tqdm # If tqdm is installed use it, otherwise use the fake wrapper
|
56 |
except ImportError:
|
57 |
tqdm = _Faketqdm
|
58 |
+
|
59 |
def load_file_from_url(
|
60 |
url: str,
|
61 |
*,
|
|
|
121 |
# We deliberately do not use NamedTemporaryFile to avoid restrictive
|
122 |
# file permissions being applied to the downloaded file.
|
123 |
dst = os.path.expanduser(dst)
|
124 |
+
print(f'PROXY DOWNLOAD: {dst}')
|
125 |
for seq in range(tempfile.TMP_MAX):
|
126 |
tmp_dst = dst + '.' + uuid.uuid4().hex + '.partial'
|
127 |
try:
|
|
|
147 |
pbar.update(len(buffer))
|
148 |
|
149 |
f.close()
|
150 |
+
print(f'PROXY DOWNLOAD: closed file {f.name}')
|
151 |
if hash_prefix is not None:
|
152 |
digest = sha256.hexdigest()
|
153 |
if digest[:len(hash_prefix)] != hash_prefix:
|
154 |
raise RuntimeError(f'invalid hash value (expected "{hash_prefix}", got "{digest}")')
|
155 |
shutil.move(f.name, dst)
|
156 |
+
print(f'PROXY DOWNLOAD: moved file {f.name} to {dst}')
|
157 |
finally:
|
158 |
+
print(f'PROXY DOWNLOAD: finally closing {f.name}')
|
159 |
f.close()
|
160 |
if os.path.exists(f.name):
|
161 |
os.remove(f.name)
|