Commit df7b01c
committed
Flux2TextEncoder.forward: forward return_dict + cache_position via kwargs
Address gemini-code-assist review comment on PR #1434
(#1434).
The previous patch captured return_dict and cache_position in the
forward signature (for backward compat with older transformers
versions where they were positional) but didn't forward them to
super().forward(). For 5.8+ callers explicitly passing these args,
they would be silently dropped.
Now forwarded the same way as output_hidden_states / output_attentions:
via kwargs.setdefault so explicit kwargs in the call still win, and
None values don't pollute **kwargs.
In transformers 5.8 these two are no-ops (return_dict always True;
cache_position computed internally), so forwarding them only matters
for older transformers versions -- but it's the correct behavior either
way, and a cheap fix.1 parent cb3ef91 commit df7b01c
1 file changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
0 commit comments