Commit 6fec5c4
committed
Fix HookedTransformerConfig rotary_base types
rotary_base is frequently set to floats in the code but was typed as
an int.
https://github.com/TransformerLensOrg/TransformerLens/blob/9c5a2a81674d5bcefa641c816b66e9827ccdf637/transformer_lens/loading_from_pretrained.py#L1984
Non-integer rotary bases are unusual but not illegal, and HF configs'
rope_theta is a float:
https://github.com/huggingface/transformers/blob/c38b2fb78eaedd4261a0e446f7976345cd1c7f1b/src/transformers/modeling_rope_utils.py#L645
This updates the type to Union[float, int] to prevent beartype errors
when loading these configs in tests.
Note that beartype doesn't consider int to be a subclass of float:
beartype/beartype#661 parent 9c5a2a8 commit 6fec5c4
File tree
2 files changed
+4
-4
lines changed- transformer_lens
- components
2 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| |||
0 commit comments