Skip to content

Commit 4a2e33b

Browse files
committed
fix: fsdp sharded state dict wont work for save_only_model knob
Signed-off-by: Mehant Kammakomati <[email protected]>
1 parent 071a161 commit 4a2e33b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/transformers/trainer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5175,6 +5175,12 @@ def create_accelerator_and_postprocess(self):
51755175
raise ValueError(
51765176
"`auto_find_batch_size` isn't supported yet with DeepSpeed Zero-3. Please consider using Zero-2, Zero-1, or FSDP"
51775177
)
5178+
if (
5179+
self.args.save_only_model
5180+
and self.is_fsdp_enabled
5181+
and "SHARDED_STATE_DICT" in str(self.accelerator.state.fsdp_plugin.state_dict_type)
5182+
):
5183+
raise ValueError("save_only_model option is not compatible with FSDP state dict type 'SHARDED_STATE_DICT'")
51785184

51795185
def propagate_args_to_deepspeed(self, auto_find_batch_size=False):
51805186
"""

0 commit comments

Comments
 (0)