docs: fix input/target shapes in DPO and ORPO forward docstrings - #1406
Open
Aryan95614 wants to merge 1 commit into
Open
Aryan95614 wants to merge 1 commit into
Aryan95614 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
forwarddocstrings ofLigerFusedLinearDPOFunctionandLigerFusedLinearORPOFunctiondescribe_input(and DPO'sref_input) as(batch_size * seq_len, hidden_size)andtargetas(batch_size * seq_len,). The implementation requires(batch_size, seq_len, hidden_size)and(batch_size, seq_len):LigerFusedLinearPreferenceBasechunks dim 0 by sequence (torch.chunk(_input[:len_chosen], dim=0)), reduces per-token log-probs over dim 1, and documents these shapes itself (_compute_lossdescribesinput_chunkas(2 * chunk_size, sequence_length, hidden_size)).test/chunked_loss/test_dpo_loss.pyandtest/chunked_loss/test_orpo_loss.pyconstruct 3D inputs (torch.randn(B, T, H, ...)).Docstring-only change;
make checkstylepasses; no kernel or convergence impact.The same wording also appears in
cpo_loss.py(lines 62, 64),simpo_loss.py(lines 70, 72), andkto_loss.py(lines 94, 96, 99, includingref_input). Happy to fold those into this PR if you prefer one sweep.Testing Done
make checkstyleto ensure code stylemake testto ensure correctness (unaffected)make test-convergenceto ensure convergence (unaffected)