Detach logits before returning from function (#3554)
This commit is contained in:
parent
7fe58d8c15
commit
91db850488
1 changed files with 1 additions and 1 deletions
|
|
@ -510,7 +510,7 @@ def grpo_trainer__get_per_token_logps_and_entropies(function_name, function):
|
|||
|
||||
os.environ["UNSLOTH_RETURN_HIDDEN_STATES"] = "0"
|
||||
# logits = logits[:, :-1, :] # (B, L-1, V), exclude the last logit: it corresponds to the next token pred
|
||||
return logits, entropies # logps, entropies
|
||||
return logits.detach(), entropies # logps, entropies
|
||||
# input_ids = input_ids[:, -logits_to_keep:]
|
||||
# For transformers<=4.48, logits_to_keep argument isn't supported, so here we drop logits ourselves.
|
||||
# See https://github.com/huggingface/trl/issues/2770
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue