-
Notifications
You must be signed in to change notification settings - Fork 637
[Feature] support stop_token_ids #4382
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
base: develop
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
…into stop_token_ids_1
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.
Must be in [0, 1]. Set to 0 to disable this. | ||
seed: Random seed to use for the generation. | ||
stop: list of strings that stop the generation when they are generated. | ||
stop_seqs: list of strings that stop the generation when they are generated. |
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
到stop_seqs
的修改,会改变对外暴露的接口名吗
next_tokens[bid] = end_ids[0]; | ||
topk_ids[bid] = end_ids[0]; | ||
return; | ||
} |
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.
这里max_tokens的限制是否必要,目前应该已经有针对max_tokens的限制了?
// If haven't reached min_tokens, cannot stop for any reason | ||
if (below_min_tokens) { | ||
if (!beam_search && is_in_end(topk_ids[bid], end_ids, end_length)) { | ||
return; |
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.
不足min_tokens的条件是不是所有情况都应该直接return
max_tokens: paddle.Tensor = None | ||
""" | ||
the maximum tokens that will be generated | ||
""" |
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.
需要看下max_tokens是否是必要参数
This PR supports stop_token_ids, which allows specifying individual token IDs that signal the model to terminate the current generation process.
Related environment variables
FD_STOP_TOKEN_IDS_MAX_LEN
: Maximum number of stop token, default is 8Usage
online serving
stop_token_ids
parameter, it can be '[List[int]]'offline demo
PR Summary
This PR addresses three main improvements:
If a stop_token_ids would trigger after max_tokens, generation stops at max_tokens instead.