-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update indexes_containing_token function #1050
Conversation
self.logger.warning( | ||
f'The token {token}, its length of indexes {indexes} is ' | ||
'not 1. Currently, it can not be used as stop words') | ||
indexes = [] | ||
self._indexes_tokens_deque.append((token, indexes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方一定等于1吧,因为入口函数这里> 1的时候过滤了
lmdeploy/lmdeploy/tokenizer.py
Lines 391 to 400 in 3380007
def indexes_containing_token(self, token): | |
"""Return all the possible indexes, whose decoding output may contain | |
the input token.""" | |
encoded = self.encode(token, add_bos=False) | |
if len(encoded) > 1: | |
self.logger.warning( | |
f'The token {token}, its length of indexes {encoded} is over ' | |
'than 1. Currently, it can not be used as stop words') | |
return [] | |
return self.model.indexes_containing_token(token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对,但是不保证这个函数单独被调用
意思是说模型输出的token_id可能不在vocab里面,然后出现的时候也要stop是么? |
主要是直接从huggingface的 AutoTokenizer 类拿属性 |
No description provided.