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
d3fc86a4
Unverified
Commit
d3fc86a4
authored
Jan 24, 2024
by
Haotian Liu
Committed by
GitHub
Jan 24, 2024
Browse files
Improve Chinese character streaming when the last char is half Chinese word. (#95)
parent
01ee0fbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
python/sglang/utils.py
python/sglang/utils.py
+3
-0
No files found.
python/sglang/utils.py
View file @
d3fc86a4
...
...
@@ -154,6 +154,9 @@ def find_printable_text(text):
# If the last token is a CJK character, we print the characters.
elif
len
(
text
)
>
0
and
_is_chinese_char
(
ord
(
text
[
-
1
])):
return
text
# Otherwise if the penultimate token is a CJK character, we print the characters except for the last one.
elif
len
(
text
)
>
1
and
_is_chinese_char
(
ord
(
text
[
-
2
])):
return
text
[:
-
1
]
# Otherwise, prints until the last space char (simple heuristic to avoid printing incomplete words,
# which may change with the subsequent token -- there are probably smarter ways to do this!)
else
:
...
...
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