Skip to content

Commit

Permalink
grad acc
Browse files Browse the repository at this point in the history
  • Loading branch information
SunMarc committed Feb 25, 2025
1 parent 3dd2668 commit 95bf5ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/peft/peft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,13 @@ def create_or_update_model_card(self, output_dir: str):
card.text = "\n".join(lines)
card.save(filename)

def gradient_checkpointing_enable(self):
if hasattr(self.base_model, "gradient_checkpointing_enable"):
self.base_model.gradient_checkpointing_enable()
self.base_model = self._prepare_model_for_gradient_checkpointing(self.base_model)
else:
raise AttributeError("gradient_checkpointing_enable is not defined")


class PeftModelForSequenceClassification(PeftModel):
"""
Expand Down

0 comments on commit 95bf5ca

Please sign in to comment.