-
Notifications
You must be signed in to change notification settings - Fork 501
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
support do_sample parameter #2375
Conversation
May conclude the demo results |
api_server.py should also be updated.
|
@@ -360,6 +360,7 @@ async def chat_completions_v1(request: ChatCompletionRequest, | |||
|
|||
gen_config = GenerationConfig( | |||
max_new_tokens=request.max_tokens, | |||
do_sample=True, |
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.
shall we make it a request option?
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.
I think it's unnecessary since users can still use top_k=1
or temperature=0.
to invoke greedy search
lmdeploy/messages.py
Outdated
bad_words = special_word_token_ids(self.bad_words) or [] | ||
stop_words.extend(self.stop_words_ids or []) | ||
bad_words.extend(self.bad_words_ids or []) | ||
self.stop_words_ids = list(set(stop_words)) or None |
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.
stop_words could be a list of list, which can be use set
a = [[123], [456]]
b = set(a) # TypeError: unhashable type: 'list'
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.
Why stop_words could be a list of list?
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.
I tested the following case:
gen_config = GenerationConfig(
stop_words=chat_template.stop_words,
stop_token_ids=[[92542], [92540]] # list of list
)
lmdeploy/messages.py
Outdated
stop_words=special_word_token_ids(gen_config.stop_words), | ||
bad_words=special_word_token_ids(gen_config.bad_words), | ||
logits_processors=gen_config.logits_processors) | ||
stop_words = special_word_token_ids(self.stop_words) or [] |
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.
May assert self.stop_words_ids
and self.bad_words_ids
None for now.
Otherwise, it probably brings in side effects if users input some unexpected token_id.
Motivation