Skip to content
Prev Previous commit
Next Next commit
Don't assume config.modules_to_save to be iterable
  • Loading branch information
nemo committed Apr 11, 2025
commit 39c7572e635c11924c41f0c69214bb624c02d8ff
2 changes: 1 addition & 1 deletion src/peft/peft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def delete_adapter(self, adapter_name: str) -> None:
def modules_to_save(self) -> Optional[set[str]]:
modules: set[str] = set()
for config in self.peft_config.values():
if hasattr(config, "modules_to_save"):
if getattr(config, "modules_to_save", None) is not None:
# modules_to_save can only be a sequence of str, not a str
modules.update(config.modules_to_save)

Expand Down
Loading