Commit 2d128f1
authored
FIX Beam search w/ mixed adapter batches & encoder (#2921)
When using mixed adapter batches (i.e. using different LoRA adapters in
the same batch), users have to pass adapter_names. When simultaneously
using beam search, these adapter names have to be extended by the number
of beams. For encoder-decoder models, even when applying beam search,
the encoder part of the model should, however, not use the extended
adapter_names. This is because the encoder still uses the original,
non-extended samples.
The need for this used to be checked by calling model.get_encoder().
However, with transformers v5, every PretrainedModel will have a
get_encoder method. The new convention is that it will return self if
there is no encoder. This is now what's being checked.
huggingface/transformers#42156
Note that said PR contains a small bug that leads to self not always
being returned. Therefore, for the full fix of the issue on transformers
main, we also need to await this PR:
huggingface/transformers#422951 parent 64f9582 commit 2d128f1
1 file changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| |||
438 | 451 | | |
439 | 452 | | |
440 | 453 | | |
441 | | - | |
| 454 | + | |
| 455 | + | |
442 | 456 | | |
443 | 457 | | |
444 | | - | |
| 458 | + | |
445 | 459 | | |
446 | 460 | | |
447 | 461 | | |
| |||
0 commit comments