Skip to content

Commit 5fa5ebe

Browse files
committed
Loosened input types on Encoding's encode functions
1 parent 97e49cb commit 5fa5ebe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tiktoken/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def encode_to_numpy(
158158
buffer = self._core_bpe.encode_to_tiktoken_buffer(text, allowed_special)
159159
return np.frombuffer(buffer, dtype=np.uint32)
160160

161-
def encode_ordinary_batch(self, text: list[str], *, num_threads: int = 8) -> list[list[int]]:
161+
def encode_ordinary_batch(self, text: Sequence[str], *, num_threads: int = 8) -> list[list[int]]:
162162
"""Encodes a list of strings into tokens, in parallel, ignoring special tokens.
163163
164164
This is equivalent to `encode_batch(text, disallowed_special=())` (but slightly faster).
@@ -174,7 +174,7 @@ def encode_ordinary_batch(self, text: list[str], *, num_threads: int = 8) -> lis
174174

175175
def encode_batch(
176176
self,
177-
text: list[str],
177+
text: Sequence[str],
178178
*,
179179
num_threads: int = 8,
180180
allowed_special: Literal["all"] | AbstractSet[str] = set(), # noqa: B006

0 commit comments

Comments
 (0)