raise error for nan hidden states - #615
Conversation
Signed-off-by: shanjiaz <hezhao@redhat.com>
Signed-off-by: shanjiaz <hezhao@redhat.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesCentralize safetensors validation helper
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
The quality checks have failed. Please run |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/speculators/train/data.py (1)
327-330: ⚡ Quick winConsider optimizing to avoid opening the file twice.
The safetensors file is opened twice in sequence: once at line 325 by
_maybe_load_hs_fileto load tensors, and again here bycheck_safetensors_fileto validate. This adds I/O overhead during hidden state generation.Consider refactoring
check_safetensors_fileto optionally return the loaded tensors, allowing a single file open operation to serve both purposes.🤖 Prompt for 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. In `@src/speculators/train/data.py` around lines 327 - 330, The safetensors file is being opened twice in succession: once by _maybe_load_hs_file to load tensors and again by check_safetensors_file to validate, creating unnecessary I/O overhead. Refactor the check_safetensors_file function to optionally return the loaded tensors in addition to performing validation, allowing you to reuse the already-loaded tensors from check_safetensors_file instead of calling _maybe_load_hs_file separately. This consolidates the file open operation into a single call while maintaining the validation logic.
🤖 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.
Nitpick comments:
In `@src/speculators/train/data.py`:
- Around line 327-330: The safetensors file is being opened twice in succession:
once by _maybe_load_hs_file to load tensors and again by check_safetensors_file
to validate, creating unnecessary I/O overhead. Refactor the
check_safetensors_file function to optionally return the loaded tensors in
addition to performing validation, allowing you to reuse the already-loaded
tensors from check_safetensors_file instead of calling _maybe_load_hs_file
separately. This consolidates the file open operation into a single call while
maintaining the validation logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 30c6f624-a91f-4ac5-958d-9a061c6e1736
📒 Files selected for processing (3)
scripts/data_generation_offline.pysrc/speculators/data_generation/offline.pysrc/speculators/train/data.py
fynnsu
left a comment
There was a problem hiding this comment.
One comment, otherwise looks good.
Signed-off-by: shanjiaz <hezhao@redhat.com>
|
The quality checks have failed. Please run |
Signed-off-by: shanjiaz <hezhao@redhat.com>
|
All links are now valid - this issue has been resolved. Marked as resolved: 9e20311 |
|
All links are now valid - this issue has been resolved. Marked as resolved: 9e20311 |
Signed-off-by: shanjiaz <hezhao@redhat.com>
Purpose
We had a failure early this week due to hiddenstatesconnector sending nan hidden states. However, our training kept going. We should explicitly fair when getting garbage hidden states
Tests
Tested locally and ran the e2e smoke tests.
Now failes directly:
Checklist
I have filled in: