project-llm-trainer 0.5.5__py3-none-any.whl → 0.5.6__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.
Potentially problematic release.
This version of project-llm-trainer might be problematic. Click here for more details.
- llm_trainer/checkpoint.py +21 -18
- {project_llm_trainer-0.5.5.dist-info → project_llm_trainer-0.5.6.dist-info}/METADATA +1 -1
- {project_llm_trainer-0.5.5.dist-info → project_llm_trainer-0.5.6.dist-info}/RECORD +12 -12
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/calc_intermediate_size +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/ddp_train +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/ds_train +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/plot_loss +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/plot_lr +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/py_train +0 -0
- {project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/smart_train +0 -0
- {project_llm_trainer-0.5.5.dist-info → project_llm_trainer-0.5.6.dist-info}/WHEEL +0 -0
- {project_llm_trainer-0.5.5.dist-info → project_llm_trainer-0.5.6.dist-info}/top_level.txt +0 -0
llm_trainer/checkpoint.py
CHANGED
|
@@ -38,29 +38,32 @@ def save_best_checkpoint(
|
|
|
38
38
|
) -> bool:
|
|
39
39
|
need_replace = not last_best_checkpoint_loss or current_loss <= last_best_checkpoint_loss
|
|
40
40
|
if need_replace and TrainerTools().parallel.is_main_process:
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
try:
|
|
42
|
+
if isinstance(TrainerTools().parallel, DsParallel):
|
|
43
|
+
checkpoint_dir = os.environ.get('DIST_CHECKPOINT_DIR', 'checkpoint')
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if checkpoint_dir.endswith('/'):
|
|
46
|
+
best_checkpoint_dir = f'{checkpoint_dir[:-1]}_best'
|
|
47
|
+
else:
|
|
48
|
+
best_checkpoint_dir = f'{checkpoint_dir}_best'
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if not os.path.exists(best_checkpoint_dir):
|
|
51
|
+
os.makedirs(best_checkpoint_dir)
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if os.path.exists(checkpoint_dir):
|
|
54
|
+
shutil.rmtree(best_checkpoint_dir)
|
|
55
|
+
shutil.copytree(checkpoint_dir, best_checkpoint_dir)
|
|
56
|
+
else:
|
|
57
|
+
checkpoint_name = os.environ.get('CHECKPOINT_NAME', DEFAULT_CHECKPOINT_NAME)
|
|
58
|
+
best_checkpoint_name = f'{checkpoint_name}_best'
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if os.path.exists(checkpoint_name):
|
|
61
|
+
if os.path.exists(best_checkpoint_name):
|
|
62
|
+
os.remove(best_checkpoint_name)
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
shutil.copy2(checkpoint_name, best_checkpoint_name)
|
|
65
|
+
except:
|
|
66
|
+
pass
|
|
64
67
|
|
|
65
68
|
TrainerTools().parallel.wait()
|
|
66
69
|
return need_replace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
llm_trainer/__init__.py,sha256=HWgtTEVeQSnZmEyYQm2K6eFEG4X2QAoigMlB5Z2tcXE,260
|
|
2
|
-
llm_trainer/checkpoint.py,sha256=
|
|
2
|
+
llm_trainer/checkpoint.py,sha256=GHRnPpvG0lz8mg2qv0itHr1rXLlj-itOqZWCtOV1IRU,4411
|
|
3
3
|
llm_trainer/dataset.py,sha256=4QlOo0SFB5816BUYegQjgobUqTUMQvdmZMM_OEAMSjE,4347
|
|
4
4
|
llm_trainer/dpo_trainer.py,sha256=1A_4QP2_xqM_YeqdXy-0RaMvEL80gim-pgnPQyHww9U,12052
|
|
5
5
|
llm_trainer/ds_checkpoint.py,sha256=D092fkS1Up4QmpV9YCpqbSzfX_caCAeX-UiOrhOE1I8,1947
|
|
@@ -20,14 +20,14 @@ llm_trainer/tools.py,sha256=yF17lp6oOfLe2XJeKDQ1juZcbv-6vFamJSLwEeArduA,2975
|
|
|
20
20
|
llm_trainer/train_configs.py,sha256=c6bgivkkWRYcPD3NzI5uRItAUhZiIBgKVMuMgVFRnFo,7336
|
|
21
21
|
llm_trainer/trainer.py,sha256=YW59dJWTyQy77cLDGzBHhfinGyfkvmWCkl1SR9hM6a8,26071
|
|
22
22
|
llm_trainer/utils.py,sha256=LWNhyQ0NDEZ9mZtk2Ryvh6EulvHIaUGIflugSpqmeFI,6791
|
|
23
|
-
project_llm_trainer-0.5.
|
|
24
|
-
project_llm_trainer-0.5.
|
|
25
|
-
project_llm_trainer-0.5.
|
|
26
|
-
project_llm_trainer-0.5.
|
|
27
|
-
project_llm_trainer-0.5.
|
|
28
|
-
project_llm_trainer-0.5.
|
|
29
|
-
project_llm_trainer-0.5.
|
|
30
|
-
project_llm_trainer-0.5.
|
|
31
|
-
project_llm_trainer-0.5.
|
|
32
|
-
project_llm_trainer-0.5.
|
|
33
|
-
project_llm_trainer-0.5.
|
|
23
|
+
project_llm_trainer-0.5.6.data/scripts/calc_intermediate_size,sha256=AggpgNHokJiJMbEtVdOnolqr_4bH3i1UYuZNEAzC2Gc,460
|
|
24
|
+
project_llm_trainer-0.5.6.data/scripts/ddp_train,sha256=x81AasaN2-9TwARFFF1l7iV1LmfMQ0bLw0i_CGbOwSw,299
|
|
25
|
+
project_llm_trainer-0.5.6.data/scripts/ds_train,sha256=qL3qc3TcedBCw98UZUjW07ONcErRawLE1HymW2AmscA,265
|
|
26
|
+
project_llm_trainer-0.5.6.data/scripts/plot_loss,sha256=MzFcdJESlVr1srj4Td6-AxPGUKkfB_QEcJwm0Bd-5fU,910
|
|
27
|
+
project_llm_trainer-0.5.6.data/scripts/plot_lr,sha256=w_7XR_x3KYYyboeOVAeu_I4fveLFI-C0wBmRrNlmWUI,894
|
|
28
|
+
project_llm_trainer-0.5.6.data/scripts/py_train,sha256=tOp9TquORQeU8XN5H7OVIk5O0Ypwi34p_GENxTwgwdk,265
|
|
29
|
+
project_llm_trainer-0.5.6.data/scripts/smart_train,sha256=Pmt4Q0to4Hoz82iB9uFPZuz7uahNUbfE7FR1940EBy8,716
|
|
30
|
+
project_llm_trainer-0.5.6.dist-info/METADATA,sha256=5JaiIS6GqDsm9o_6Zz-vkec_0rmENISg32Qld1Gn-u8,195
|
|
31
|
+
project_llm_trainer-0.5.6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
32
|
+
project_llm_trainer-0.5.6.dist-info/top_level.txt,sha256=LtRFg28i0QIG7iBCD2t095oSco99LCtkijibS9cMGik,12
|
|
33
|
+
project_llm_trainer-0.5.6.dist-info/RECORD,,
|
{project_llm_trainer-0.5.5.data → project_llm_trainer-0.5.6.data}/scripts/calc_intermediate_size
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|