mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-08-07 23:45:30 +00:00
convert : import bytes_to_unicode from convert_slow_tokenizer (#26217)
bytes_to_unicode was removed from transformers.models.gpt2.tokenization_gpt2 in huggingface/transformers#40936, but it had already been copied into transformers.convert_slow_tokenizer in huggingface/transformers#30334 (transformers 4.54.1), so import it directly from there. Applies the same fix to chatglm.py.
This commit is contained in:
parent
1269cb1ff1
commit
b06fbc968b
2 changed files with 2 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ class ChatGLMModel(TextModel):
|
|||
|
||||
@staticmethod
|
||||
def token_bytes_to_string(b):
|
||||
from transformers.models.gpt2.tokenization_gpt2 import bytes_to_unicode # ty: ignore[unresolved-import]
|
||||
from transformers.convert_slow_tokenizer import bytes_to_unicode
|
||||
byte_encoder = bytes_to_unicode()
|
||||
return ''.join([byte_encoder[ord(char)] for char in b.decode('latin-1')])
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class QwenModel(TextModel):
|
|||
|
||||
@staticmethod
|
||||
def token_bytes_to_string(b):
|
||||
from transformers.models.gpt2.tokenization_gpt2 import bytes_to_unicode # ty: ignore[unresolved-import]
|
||||
from transformers.convert_slow_tokenizer import bytes_to_unicode
|
||||
byte_encoder = bytes_to_unicode()
|
||||
return ''.join([byte_encoder[ord(char)] for char in b.decode('latin-1')])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue