Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

描述问题

about chart format,[UNUSED_TOKEN_146] means 146 token or self

tokenizer.decode([146])
print(a)
# <0x8F>
b = tokenizer.encode("[UNUSED_TOKEN_146]")
print(b)
# [1, 640, 2010, 15927, 8783, 3553, 304, 284, 10389, 332]

so what means?

You must be logged in to vote

[UNUSED_TOKEN_146] means the 146th unused token in pre-training, so it should be treated as a whole in tokenization. However, it seems that you are using a different tokenizer, because correct results should be:

In [1]: import torch
   ...: from transformers import AutoModelForCausalLM, AutoTokenizer
   ...: 
   ...: model_path = "internlm/internlm2-chat-7b"
   ...: 
   ...: tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)


In [2]: 

In [2]: tokenizer.encode('[UNUSED_TOKEN_146]')
Out[2]: [1, 92543]

In [3]: tokenizer.encode('[UNUSED_TOKEN_145]')
Out[3]: [1, 92542]

In [4]:

Replies: 2 comments · 1 reply

Comment options

[UNUSED_TOKEN_146] means the 146th unused token in pre-training, so it should be treated as a whole in tokenization. However, it seems that you are using a different tokenizer, because correct results should be:

In [1]: import torch
   ...: from transformers import AutoModelForCausalLM, AutoTokenizer
   ...: 
   ...: model_path = "internlm/internlm2-chat-7b"
   ...: 
   ...: tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)


In [2]: 

In [2]: tokenizer.encode('[UNUSED_TOKEN_146]')
Out[2]: [1, 92543]

In [3]: tokenizer.encode('[UNUSED_TOKEN_145]')
Out[3]: [1, 92542]

In [4]:
You must be logged in to vote
1 reply
@limoncc
Comment options

It is appreciated for answering. because I use a gguf, i will check.

Answer selected by ZwwWayne
Comment options

#619 provide more description.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #614 on January 18, 2024 02:39.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.