This repository was archived by the owner on Sep 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
[AOTI] Add a --max-seq-length option for export #1018
Merged
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
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
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 |
|---|---|---|
|
|
@@ -113,10 +113,19 @@ def main(args): | |
| except: | ||
| tokenizer = None | ||
|
|
||
| if ( | ||
| output_dso_path is not None | ||
| and builder_args.max_seq_length is None | ||
| and not builder_args.dynamic_shapes | ||
| ): | ||
| print("Setting max_seq_length to 300 for DSO export.") | ||
| builder_args.max_seq_length = 300 | ||
|
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. you shouldn't need this if you set the default in the other file 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. I can add more details to the printout if that helps. |
||
|
|
||
| model = _initialize_model( | ||
| builder_args, | ||
| quantize, | ||
| tokenizer, | ||
| max_seq_length=builder_args.max_seq_length, | ||
| ) | ||
| model_to_pte = model | ||
| model_to_dso = model | ||
|
|
||
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.
set the default to 300 and update the help string so that it's clear what the default is (300)
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.
That was my initial implementation. Then there was an issue when running eval.
When running eval, we use
--dynamic-shapeswhich uses a larger max_seq_length, i.e. model.config.max_seq_length. But in theory, we should not stop user from calling eval with both options, something like--dynamic-shapes --max-seq-length 1000. When that happens, if args.max_seq_length has a default value, we will have no way to distinguish if args.max_seq_length is from a default value or from an intentional user overwriting.