Commit 423301b
committed
fix(generate): avoid None entries in merged logits_processors
PromptProcessingBatch.extend filled missing per-slot logits_processors
with [None] when either side lacked configured processors. Merging an
unconfigured batch with a processor-equipped batch then produced a list
shaped like [None, ..., [fn], ...]. GenerationBatch._step at line 1346
iterates self.logits_processors[e] under the any() guard at line 1337,
which raises TypeError on the None slots.
Fill with [[]] instead. Matches the existing pattern at line 1120
(filter() restoring [[]] * len(keep)) and the per-slot type
List[Callable].
Reproduce: construct two PromptProcessingBatch instances, one without
processors and one with, then call extend; the merged
self.logits_processors contains None entries. New unit test covers this
shape directly.1 parent ed1fca4 commit 423301b
2 files changed
Lines changed: 31 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
1066 | | - | |
| 1066 | + | |
1067 | 1067 | | |
1068 | 1068 | | |
1069 | 1069 | | |
1070 | 1070 | | |
1071 | | - | |
| 1071 | + | |
1072 | 1072 | | |
1073 | 1073 | | |
1074 | 1074 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
405 | 434 | | |
406 | 435 | | |
407 | 436 | | |
| |||
0 commit comments