Commit 194d5ff
fix: handle control pool smaller than n_samples in _sample_consecutive_controls
When n_samples > pool_size (e.g., observational data with rare cell types
having only 2 control cells but sentence_len=64), the old tail+head wrap
only wrapped once, returning fewer elements than requested. This caused
IndexError in __getitems__ during multi-worker DataLoader training.
Use modular arithmetic to wrap around the pool as many times as needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 28b7bb3 commit 194d5ff
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
0 commit comments