Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
grad post hook update
  • Loading branch information
GAD-cell committed Jun 17, 2025
commit c54e91cc2898ce0ed10d888e8f02a1dbbfe7d242
2 changes: 1 addition & 1 deletion unsloth_zoo/peft_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def requires_grad_post_hook(module, input, output):
try: # For dataclass from HF, try on loss or logits
if hasattr(output, "loss") and output.loss is not None:
output.loss.requires_grad_(True)
elif hasattr(output, "logits") and output.logits is not None: #with RL like GRPO there are no loss as you don't provide labels
elif hasattr(output, "logits") and output.logits is not None: #with RL like GRPO there are no loss as you don't provide labels
output.logits.requires_grad_(True)
else:
raise ValueError("Neither loss nor logits are available for grad post hook.")
Expand Down