| 115 | return list(executor.map(self.encode_ordinary, text)) |
| 116 | |
| 117 | def encode_batch( |
| 118 | self, |
| 119 | text: Sequence[str], |
| 120 | *, |
| 121 | num_threads: int = 8, |
| 122 | allowed_special: AllowedSpecial = frozenset(), |
| 123 | disallowed_special: SpecialTokens = "all", |
| 124 | ) -> list[list[int]]: # mutable-ok: [LIT001] SDK return type |
| 125 | encode: Final = partial(self.encode, allowed_special=allowed_special, disallowed_special=disallowed_special) |
| 126 | with ThreadPoolExecutor(num_threads) as executor: |
| 127 | return list(executor.map(encode, text)) |
| 128 | |
| 129 | def encode_with_unstable( |
| 130 | self, |