File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
gpt_oss/tools/simple_browser Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,13 @@ def mark_lines(text: str) -> str:
87
87
88
88
89
89
@functools .cache
90
- def _tiktoken_vocabulary_lenghts (enc_name : str ) -> list [int ]:
90
+ def _tiktoken_vocabulary_lengths (enc_name : str ) -> list [int ]:
91
91
encoding = tiktoken .get_encoding (enc_name )
92
92
return [len (encoding .decode ([i ])) for i in range (encoding .n_vocab )]
93
93
94
94
95
95
def warmup_caches (enc_names : list [str ]) -> None :
96
- for _ in map (_tiktoken_vocabulary_lenghts , enc_names ):
96
+ for _ in map (_tiktoken_vocabulary_lengths , enc_names ):
97
97
pass
98
98
99
99
Original file line number Diff line number Diff line change @@ -102,8 +102,8 @@ def max_chars_per_token(enc_name: str) -> int:
102
102
def get_tokens (text : str , enc_name : str ) -> Tokens :
103
103
encoding = tiktoken .get_encoding (enc_name )
104
104
tokens = encoding .encode (text , disallowed_special = ())
105
- _vocabulary_lenghts = _tiktoken_vocabulary_lengths (enc_name )
106
- tok2idx = [0 ] + list (itertools .accumulate (_vocabulary_lenghts [i ] for i in tokens ))[
105
+ _vocabulary_lengths = _tiktoken_vocabulary_lengths (enc_name )
106
+ tok2idx = [0 ] + list (itertools .accumulate (_vocabulary_lengths [i ] for i in tokens ))[
107
107
:- 1
108
108
]
109
109
result = Tokens (tokens = tokens , tok2idx = tok2idx )
You can’t perform that action at this time.
0 commit comments