-
Notifications
You must be signed in to change notification settings - Fork 325
fix(basemodel): Format AssertionError message for max_seq_length vs max_total_token_num #1300
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
Merged
+14
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -212,9 +212,23 @@ def _init_kv_move_buffer(self): | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def _check_mem_size(self): | ||||||||||||||||||||||||||
| self.max_total_token_num = self.mem_manager.size | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| assert ( | ||||||||||||||||||||||||||
| self.max_total_token_num > self.batch_max_tokens | ||||||||||||||||||||||||||
| ), "max_total_token_num must be greater than batch_max_tokens" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # 非个人性能模式下,需要保证 max_seq_length 小于等于 max_total_token_num, | ||||||||||||||||||||||||||
| # 这样才能得到完整的上下文长度的支持。个人模式主要是私有化场景,显卡显存不是 | ||||||||||||||||||||||||||
| # 特别大,可能能分配的 kv 容量有限,无法支持 max_seq_length 的推理。所以个人模式下 | ||||||||||||||||||||||||||
| # 可以适当放宽这个限制,不做这个校验。 | ||||||||||||||||||||||||||
| if self.args.performance_mode != "personal": | ||||||||||||||||||||||||||
| assert self.max_seq_length <= self.max_total_token_num, ( | ||||||||||||||||||||||||||
| f"max_total_token_num must be >= max_seq_length, " | ||||||||||||||||||||||||||
| f"got max_total_token_num={self.max_total_token_num}, " | ||||||||||||||||||||||||||
| f"max_seq_length={self.max_seq_length}. " | ||||||||||||||||||||||||||
| f"Try set --max_req_total_len a smaller value < {self.max_total_token_num}." | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
Comment on lines
+225
to
+230
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message suggestion uses
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def _init_req_manager(self): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
For consistency with the detailed error message added below, consider including the actual values of
max_total_token_numandbatch_max_tokensin this assertion message. This helps users diagnose configuration issues more easily.