Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions swift/llm/argument/train_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def _init_deepspeed(self):

def _init_fsdp(self):
if not self.fsdp:
self.fsdp = []
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While setting self.fsdp = [] fixes the compatibility issue, it introduces a type inconsistency. The fsdp attribute is type-hinted as Optional[str] on line 204, but you are assigning a list to it. To maintain type consistency, it would be better to set it to an empty string "". This is also a safe "disabled" value across different transformers versions and respects the established type hint.

Suggested change
self.fsdp = []
self.fsdp = ""

return

if is_mp() and not self.use_ray:
Expand Down