Commit 6fea888
Fix Qwen3Next import errors on old transformers versions (#2030)
SUMMARY:
Currently, we support `transformers>=4.54.0`, however `Qwen3Next` was
only added in `transformers==4.57.0`. This updates the code so that:
1. In `src/llmcompressor/modeling/qwen3_next_moe.py` we only used the
imports for typing, so they've been moved into an `if TYPE_CHECKING`
block.
2. In `tests/llmcompressor/modeling/test_calib_qwen3_next.py` we wrap
the import statement in a try-except and skip the Qwen3Next test if they
fail to import.
TEST PLAN:
Run CI.
---------
Signed-off-by: Fynn Schmitt-Ulms <[email protected]>
Co-authored-by: Dipika Sikka <[email protected]>1 parent 81eff05 commit 6fea888
File tree
2 files changed
+24
-8
lines changed- src/llmcompressor/modeling
- tests/llmcompressor/modeling
2 files changed
+24
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
14 | 23 | | |
15 | 24 | | |
16 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
17 | 30 | | |
18 | 31 | | |
19 | 32 | | |
| |||
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
| |||
0 commit comments