Repository navigation
Commit c8cbdde
Fix autothink and thinkdeeper for transformers>=5 (#320)
* Fix autothink and thinkdeeper for transformers>=5
* Keep device transfer when unwrapping BatchEncoding, cover deepconf, bump 0.3.22
Builds on the transformers>=5 fix: apply_chat_template now returns a
BatchEncoding, so the tensor must be unwrapped via .input_ids.
Two corrections to the original change:
1. Preserve the device transfer. `tokens.to(device)` was called without
assigning the result, but Tensor.to() is not in-place -- it returns a new
tensor. As written the tokens stayed on CPU, so on CUDA/MPS the subsequent
model(input_ids=tokens, ...) would fail with a device mismatch. A CPU-only
repro hides this. Chain it instead: .input_ids.to(self.model.device).
2. Apply the same fix to optillm/deepconf/processor.py, which has the identical
apply_chat_template(return_tensors="pt") -> model(input_ids=tokens) pattern
and was still passing a BatchEncoding.
Also updates the README badges (drop the GitHub stars badge, use the pepy.tech
downloads badge which reports actual counts) and bumps the version to 0.3.22.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Asankhaya Sharma <codelion@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c258858 commit c8cbdde
6 files changed
Lines changed: 6 additions & 8 deletions
File tree
- optillm
- autothink
- deepconf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments