mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-30 02:53:41 +08:00
Handle empty string case in maybe_trim_space
This commit is contained in:
parent
f491d473a3
commit
d8ca500136
@ -193,7 +193,9 @@ class BPEStreamingDetokenizer(StreamingDetokenizer):
|
|||||||
self.tokens = []
|
self.tokens = []
|
||||||
|
|
||||||
def _maybe_trim_space(self, current_text):
|
def _maybe_trim_space(self, current_text):
|
||||||
if current_text[0] != " ":
|
if len(current_text) < 1 or current_text is None:
|
||||||
|
return current_text
|
||||||
|
elif current_text[0] != " ":
|
||||||
return current_text
|
return current_text
|
||||||
elif not self.text:
|
elif not self.text:
|
||||||
return current_text[1:]
|
return current_text[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user