feat(ws1):Add LogProb reference operator interface(reuse)#179
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesNativeLogpOp API refactor, tests, and docs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_logp.py`:
- Around line 96-99: The assert statements checking torch.equal results in the
test_logp.py file need to be reformatted to comply with Black's code formatting
standards. Locate the assert statements in the forward_fp32 test block (around
line 96) and at line 130-133 that check torch.equal(full_out[row],
single_out[0]) and reformat them according to Black's multi-line formatting
rules to ensure the parentheses, line breaks, and indentation match what Black
expects, which will unblock the linting CI.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 55f63297-1a32-43d5-bd32-272905316723
📒 Files selected for processing (3)
docs/operators/fused-logp.mdrl_engine/kernels/ops/pytorch/loss/logp.pytests/test_logp.py
Summary
Add the reference-operator interface to NativeLogpOp
This keeps the existing selected-token log probability implementation and adds the unified baseline contract:
forward(logits, token_ids)forward_fp32(logits, token_ids)op_class = "logprob"The existing
apply(...)andapply_fp32(...)APIs remain available as backward-compatible aliases.
Implementation
rl_engine/kernels/ops/pytorch/loss/logp.pytests/test_logp.pydocs/operators/fused-logp.mdSummary by CodeRabbit
Release Notes
New Features
forward(...)andforward_fp32(...)methods for the LogP operator with explicit dtype behavior.apply(...)/apply_fp32(...)as backward-compatible aliases of the new methods.Documentation
Tests
NativeLogpOptest suite validating output shape/dtype, aliasing behavior, purity, registry dispatch, input validation, batch invariance, and numeric accuracy.