Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
69193f71
Unverified
Commit
69193f71
authored
Nov 01, 2025
by
Ke Bao
Committed by
GitHub
Nov 01, 2025
Browse files
Filter tokenizer warning for kimi models (#12485)
parent
d5b6e50f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
python/sglang/srt/utils/hf_transformers_utils.py
python/sglang/srt/utils/hf_transformers_utils.py
+11
-0
No files found.
python/sglang/srt/utils/hf_transformers_utils.py
View file @
69193f71
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
contextlib
import
contextlib
import
json
import
json
import
logging
import
os
import
os
import
tempfile
import
tempfile
import
warnings
import
warnings
...
@@ -348,6 +349,12 @@ def get_context_length(config):
...
@@ -348,6 +349,12 @@ def get_context_length(config):
_FAST_LLAMA_TOKENIZER
=
"hf-internal-testing/llama-tokenizer"
_FAST_LLAMA_TOKENIZER
=
"hf-internal-testing/llama-tokenizer"
# Filter warnings like: https://github.com/sgl-project/sglang/issues/8082
class
TokenizerWarningsFilter
(
logging
.
Filter
):
def
filter
(
self
,
record
:
logging
.
LogRecord
)
->
bool
:
return
"Calling super().encode with"
not
in
record
.
getMessage
()
def
get_tokenizer
(
def
get_tokenizer
(
tokenizer_name
:
str
,
tokenizer_name
:
str
,
*
args
,
*
args
,
...
@@ -393,6 +400,10 @@ def get_tokenizer(
...
@@ -393,6 +400,10 @@ def get_tokenizer(
clean_up_tokenization_spaces
=
False
,
clean_up_tokenization_spaces
=
False
,
**
kwargs
,
**
kwargs
,
)
)
# Filter tokenizer warnings
logging
.
getLogger
(
tokenizer
.
__class__
.
__module__
).
addFilter
(
TokenizerWarningsFilter
()
)
except
TypeError
as
e
:
except
TypeError
as
e
:
# The LLaMA tokenizer causes a protobuf error in some environments.
# The LLaMA tokenizer causes a protobuf error in some environments.
err_msg
=
(
err_msg
=
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment