nshtrainer 0.18.1__py3-none-any.whl → 0.18.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nshtrainer/_hf_hub.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import logging
|
|
2
3
|
import os
|
|
3
4
|
from pathlib import Path
|
|
@@ -299,7 +300,22 @@ def _save_checkpoint_files(
|
|
|
299
300
|
# Resolve the repository name
|
|
300
301
|
repo_name = _repo_name(api, root_config)
|
|
301
302
|
|
|
303
|
+
# Let's read all the files to memory right now,
|
|
304
|
+
# in case they get used/removed by other processes.
|
|
305
|
+
# Read all the files to memory
|
|
306
|
+
file_contents: list[bytes | None] = []
|
|
302
307
|
for p in paths:
|
|
308
|
+
try:
|
|
309
|
+
with open(p, "rb") as f:
|
|
310
|
+
file_contents.append(f.read())
|
|
311
|
+
except IOError as e:
|
|
312
|
+
log.warning(f"Failed to read checkpoint file {p}: {str(e)}")
|
|
313
|
+
file_contents.append(None)
|
|
314
|
+
|
|
315
|
+
for p, contents in zip(paths, file_contents):
|
|
316
|
+
if contents is None:
|
|
317
|
+
continue
|
|
318
|
+
|
|
303
319
|
try:
|
|
304
320
|
relative_path = p.relative_to(checkpoint_dir)
|
|
305
321
|
except ValueError:
|
|
@@ -314,7 +330,7 @@ def _save_checkpoint_files(
|
|
|
314
330
|
# Upload the checkpoint file to the repository
|
|
315
331
|
try:
|
|
316
332
|
api.upload_file(
|
|
317
|
-
path_or_fileobj=
|
|
333
|
+
path_or_fileobj=io.BytesIO(contents),
|
|
318
334
|
path_in_repo=str(path_in_repo),
|
|
319
335
|
repo_id=repo_name,
|
|
320
336
|
repo_type="model",
|
|
@@ -3,7 +3,7 @@ nshtrainer/_checkpoint/loader.py,sha256=myFObRsPdb8jBncMK73vjr5FDJIfKhF86Ec_kSjX
|
|
|
3
3
|
nshtrainer/_checkpoint/metadata.py,sha256=p5e7dhVPpOGrXeuesq_7Y_RHi5lguzDAR_UXtMJXzWU,5175
|
|
4
4
|
nshtrainer/_checkpoint/saver.py,sha256=DkbCH0YeOJ71m32vAARiQdGBf0hvwwdoAV8LOFGy-0Y,1428
|
|
5
5
|
nshtrainer/_experimental/__init__.py,sha256=pEXPyI184UuDHvfh4p9Kg9nQZQZI41e4_HvNd4BK-yg,81
|
|
6
|
-
nshtrainer/_hf_hub.py,sha256=
|
|
6
|
+
nshtrainer/_hf_hub.py,sha256=Py9_8ADvMCFPaJzeE7bxm8Mgs3mEMkyWJ4pDEccTGt8,11230
|
|
7
7
|
nshtrainer/callbacks/__init__.py,sha256=4qocBDzQbLLhhbIEfvbA3SQB_Dy9ZJH7keMwPay-ZS8,2359
|
|
8
8
|
nshtrainer/callbacks/_throughput_monitor_callback.py,sha256=aJo_11rc4lo0IYOd-kHmPDtzdC4ctgXyRudkRJqH4m4,23184
|
|
9
9
|
nshtrainer/callbacks/actsave.py,sha256=qbnaKts4_dvjPeAaPtv7Ds12_vEWzaHUfg_--49NB9I,4041
|
|
@@ -85,6 +85,6 @@ nshtrainer/util/seed.py,sha256=Or2wMPsnQxfnZ2xfBiyMcHFIUt3tGTNeMMyOEanCkqs,280
|
|
|
85
85
|
nshtrainer/util/slurm.py,sha256=rofIU26z3SdL79SF45tNez6juou1cyDLz07oXEZb9Hg,1566
|
|
86
86
|
nshtrainer/util/typed.py,sha256=NGuDkDzFlc1fAoaXjOFZVbmj0mRFjsQi1E_hPa7Bn5U,128
|
|
87
87
|
nshtrainer/util/typing_utils.py,sha256=8ptjSSLZxlmy4FY6lzzkoGoF5fGNClo8-B_c0XHQaNU,385
|
|
88
|
-
nshtrainer-0.18.
|
|
89
|
-
nshtrainer-0.18.
|
|
90
|
-
nshtrainer-0.18.
|
|
88
|
+
nshtrainer-0.18.2.dist-info/METADATA,sha256=vev96DaxCnqJOAvvGrGOJ37OpWNFLrCdtGPN-kpnvO4,935
|
|
89
|
+
nshtrainer-0.18.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
90
|
+
nshtrainer-0.18.2.dist-info/RECORD,,
|
|
File without changes
|