project-llm-trainer 0.4.3__py3-none-any.whl → 0.4.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/ds_checkpoint.py +27 -12
- llm_trainer/generate_utils.py +1 -1
- llm_trainer/trainer.py +6 -6
- {project_llm_trainer-0.4.3.dist-info → project_llm_trainer-0.4.6.dist-info}/METADATA +1 -1
- {project_llm_trainer-0.4.3.dist-info → project_llm_trainer-0.4.6.dist-info}/RECORD +14 -14
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/calc_intermediate_size +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/ddp_train +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/ds_train +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/plot_loss +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/plot_lr +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/py_train +0 -0
- {project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.6.data}/scripts/smart_train +0 -0
- {project_llm_trainer-0.4.3.dist-info → project_llm_trainer-0.4.6.dist-info}/WHEEL +0 -0
- {project_llm_trainer-0.4.3.dist-info → project_llm_trainer-0.4.6.dist-info}/top_level.txt +0 -0
llm_trainer/ds_checkpoint.py
CHANGED
|
@@ -77,18 +77,33 @@ def _get_ds_full_state_dict_on_rank0(model: DeepSpeedEngine) -> Optional[dict]:
|
|
|
77
77
|
return {k: v.cpu().clone() for k, v in model.module.state_dict().items()}
|
|
78
78
|
return None
|
|
79
79
|
|
|
80
|
-
# ZeRO-3
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if
|
|
84
|
-
with
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
# --- ZeRO-3 ---
|
|
81
|
+
# 只调用一次 GatheredParameters,传入所有参数
|
|
82
|
+
with deepspeed.zero.GatheredParameters(model.parameters(), modifier_rank=0):
|
|
83
|
+
if TrainerTools().parallel.is_main_process:
|
|
84
|
+
# 在这个 'with' 代码块内,rank 0 上的 model.module 拥有完整的参数
|
|
85
|
+
# 所以我们可以像操作普通模型一样直接调用 state_dict()
|
|
86
|
+
full_state_dict = model.module.state_dict()
|
|
87
|
+
|
|
88
|
+
# 将其克隆到 CPU 并返回
|
|
89
|
+
return {k: v.cpu().clone() for k, v in full_state_dict.items()}
|
|
90
|
+
|
|
91
|
+
# 其他 rank 执行到这里时,上下文结束,直接返回 None
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
# # ZeRO-3
|
|
95
|
+
# state_dict_on_rank_0 = {}
|
|
96
|
+
# for param_name, param in model.module.named_parameters():
|
|
97
|
+
# if hasattr(param, 'ds_id'):
|
|
98
|
+
# with deepspeed.zero.GatheredParameters(param, modifier_rank=0):
|
|
99
|
+
# if TrainerTools().parallel.is_main_process:
|
|
100
|
+
# state_dict_on_rank_0[param_name] = param.data.to(torch.float32).cpu().clone()
|
|
101
|
+
# else:
|
|
102
|
+
# print("22222222")
|
|
103
|
+
# if TrainerTools().parallel.is_main_process:
|
|
104
|
+
# state_dict_on_rank_0[param_name] = param.data.to(torch.float32).cpu().clone()
|
|
105
|
+
#
|
|
106
|
+
# return state_dict_on_rank_0 if TrainerTools().parallel.is_main_process else None
|
|
92
107
|
|
|
93
108
|
|
|
94
109
|
def get_ds_model_params(model: nn.Module):
|
llm_trainer/generate_utils.py
CHANGED
|
@@ -244,7 +244,7 @@ def streaming_generate(
|
|
|
244
244
|
max_position_embeddings: int,
|
|
245
245
|
max_new_tokens: int,
|
|
246
246
|
temperature: Optional[float] = 1.0,
|
|
247
|
-
k: Optional[int] =
|
|
247
|
+
k: Optional[int] = None,
|
|
248
248
|
p: Optional[float] = 1.0,
|
|
249
249
|
pixel_values: Optional[torch.Tensor] = None,
|
|
250
250
|
tokens_per_image: int = -1,
|
llm_trainer/trainer.py
CHANGED
|
@@ -139,10 +139,10 @@ class Trainer:
|
|
|
139
139
|
if not any(sub_module in name for sub_module in ['multi_modal_projector']):
|
|
140
140
|
param.requires_grad = False
|
|
141
141
|
|
|
142
|
-
model.embed_tokens.eval()
|
|
143
|
-
model.layers.eval()
|
|
144
|
-
model.head_norm.eval()
|
|
145
|
-
model.lm_head.eval()
|
|
142
|
+
# model.embed_tokens.eval()
|
|
143
|
+
# model.layers.eval()
|
|
144
|
+
# model.head_norm.eval()
|
|
145
|
+
# model.lm_head.eval()
|
|
146
146
|
|
|
147
147
|
if TrainerTools().parallel.is_main_process:
|
|
148
148
|
total_params = sum(p.numel() for p in model.parameters())
|
|
@@ -421,7 +421,7 @@ class Trainer:
|
|
|
421
421
|
|
|
422
422
|
if TrainerTools().parallel.is_main_process:
|
|
423
423
|
eval_prompt, eval_image_tag = self._get_eval_data()
|
|
424
|
-
if isinstance(self.
|
|
424
|
+
if isinstance(self.train_config, VLMConfig) and self.pixel_values_provider and eval_image_tag:
|
|
425
425
|
eval_pixel_values = self.pixel_values_provider([eval_image_tag])
|
|
426
426
|
else:
|
|
427
427
|
eval_pixel_values = None
|
|
@@ -445,7 +445,7 @@ class Trainer:
|
|
|
445
445
|
|
|
446
446
|
if TrainerTools().parallel.is_main_process:
|
|
447
447
|
eval_prompt, eval_image_tag = self._get_eval_data()
|
|
448
|
-
if isinstance(self.
|
|
448
|
+
if isinstance(self.train_config, VLMConfig) and self.pixel_values_provider and eval_image_tag:
|
|
449
449
|
eval_pixel_values = self.pixel_values_provider([eval_image_tag])
|
|
450
450
|
else:
|
|
451
451
|
eval_pixel_values = None
|
|
@@ -3,10 +3,10 @@ llm_trainer/checkpoint.py,sha256=yZcExxneN2yzvWxRiK-pstMWs35LV7GiOfqcLq-S6vc,574
|
|
|
3
3
|
llm_trainer/dataset.py,sha256=4QlOo0SFB5816BUYegQjgobUqTUMQvdmZMM_OEAMSjE,4347
|
|
4
4
|
llm_trainer/dcp.py,sha256=PkD97DyrOtoTKn4FJsfL3VqAy4dxufgjdzJEz8-Cnoc,3635
|
|
5
5
|
llm_trainer/dpo_trainer.py,sha256=rC_I5ipesSlP3gFK_SG2GB8NbgJAMu4K7KLxkAS-aRY,13406
|
|
6
|
-
llm_trainer/ds_checkpoint.py,sha256=
|
|
6
|
+
llm_trainer/ds_checkpoint.py,sha256=7o9oxHUqPJNQESuZz83vHUmV83AkUh19mV9nY6qg4PE,4957
|
|
7
7
|
llm_trainer/eval.py,sha256=NDm8PbXLch7xT81xPYPRCNrcrB_Xj5GDJSCxyVwUOp4,1524
|
|
8
8
|
llm_trainer/fsdp_checkpoint.py,sha256=lqZFzHyWyfzuCq_81kQNtJd2qaiMeY1N5BCEMnrJTBw,3192
|
|
9
|
-
llm_trainer/generate_utils.py,sha256=
|
|
9
|
+
llm_trainer/generate_utils.py,sha256=_3TWAt-W8ZIzDZrLHEBR2iiZ3bn4V34WuVvKgCuDtyI,15193
|
|
10
10
|
llm_trainer/grpo_trainer.py,sha256=bZPrxhyPQLAnFzWhI7hhA6fpuKVNwj7nOm9k0ku9aK4,15977
|
|
11
11
|
llm_trainer/log.py,sha256=LxqTGRNZUGMTSQCePRpk-rYyxSnSIbT4kOdP8Fbzr0M,462
|
|
12
12
|
llm_trainer/loss.py,sha256=Yv3fsaVuZ5AhnGPJOr5vEMb_tM2urR6mCb4DBbrHHI8,6030
|
|
@@ -20,16 +20,16 @@ llm_trainer/sft_trainer.py,sha256=gxQA7T1o1QGUsHp2CX1Qb_fO5LppBJuNbc0H4ixCYUA,17
|
|
|
20
20
|
llm_trainer/tokenizer.py,sha256=A7TYYUbtPf75kjCvWP7yBui4xZBObMk2aPem62YpwpY,6776
|
|
21
21
|
llm_trainer/tools.py,sha256=O45-20wRmh-nyTfU-U-XtjbKAoe7boEIsUvWT_NaKx4,3041
|
|
22
22
|
llm_trainer/train_configs.py,sha256=arnet3tIzgVnwshod08F1jE7r4I7e-SIgMy55IagPnE,15971
|
|
23
|
-
llm_trainer/trainer.py,sha256=
|
|
23
|
+
llm_trainer/trainer.py,sha256=Zy1oesBfsFlDedZ4hn3gcAkTrpi5fr76bFFQikfAkak,25351
|
|
24
24
|
llm_trainer/utils.py,sha256=-ivhMF0d999va13S1wt2uBvtVw8Nvr3uBzhaUFKL04Q,6826
|
|
25
|
-
project_llm_trainer-0.4.
|
|
26
|
-
project_llm_trainer-0.4.
|
|
27
|
-
project_llm_trainer-0.4.
|
|
28
|
-
project_llm_trainer-0.4.
|
|
29
|
-
project_llm_trainer-0.4.
|
|
30
|
-
project_llm_trainer-0.4.
|
|
31
|
-
project_llm_trainer-0.4.
|
|
32
|
-
project_llm_trainer-0.4.
|
|
33
|
-
project_llm_trainer-0.4.
|
|
34
|
-
project_llm_trainer-0.4.
|
|
35
|
-
project_llm_trainer-0.4.
|
|
25
|
+
project_llm_trainer-0.4.6.data/scripts/calc_intermediate_size,sha256=AggpgNHokJiJMbEtVdOnolqr_4bH3i1UYuZNEAzC2Gc,460
|
|
26
|
+
project_llm_trainer-0.4.6.data/scripts/ddp_train,sha256=x81AasaN2-9TwARFFF1l7iV1LmfMQ0bLw0i_CGbOwSw,299
|
|
27
|
+
project_llm_trainer-0.4.6.data/scripts/ds_train,sha256=qL3qc3TcedBCw98UZUjW07ONcErRawLE1HymW2AmscA,265
|
|
28
|
+
project_llm_trainer-0.4.6.data/scripts/plot_loss,sha256=MzFcdJESlVr1srj4Td6-AxPGUKkfB_QEcJwm0Bd-5fU,910
|
|
29
|
+
project_llm_trainer-0.4.6.data/scripts/plot_lr,sha256=w_7XR_x3KYYyboeOVAeu_I4fveLFI-C0wBmRrNlmWUI,894
|
|
30
|
+
project_llm_trainer-0.4.6.data/scripts/py_train,sha256=tOp9TquORQeU8XN5H7OVIk5O0Ypwi34p_GENxTwgwdk,265
|
|
31
|
+
project_llm_trainer-0.4.6.data/scripts/smart_train,sha256=Pmt4Q0to4Hoz82iB9uFPZuz7uahNUbfE7FR1940EBy8,716
|
|
32
|
+
project_llm_trainer-0.4.6.dist-info/METADATA,sha256=PcLGKG5luK4XZFXbVRjiBrXNq9EzRvWCgZ6K1cxMzlo,195
|
|
33
|
+
project_llm_trainer-0.4.6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
34
|
+
project_llm_trainer-0.4.6.dist-info/top_level.txt,sha256=LtRFg28i0QIG7iBCD2t095oSco99LCtkijibS9cMGik,12
|
|
35
|
+
project_llm_trainer-0.4.6.dist-info/RECORD,,
|
{project_llm_trainer-0.4.3.data → project_llm_trainer-0.4.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
|