-
Notifications
You must be signed in to change notification settings - Fork 472
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
[TorchAcc] Update padding strategy when using persistent cache #2464
Conversation
swift/torchacc_utils.py
Outdated
@@ -30,6 +30,15 @@ def get_bucket_sizes(max_length: int) -> List[int]: | |||
if os.getenv('TORCHACC_DATA_BUCKETS') is not None: | |||
bucket_sizes = [int(x) for x in os.getenv('TORCHACC_DATA_BUCKETS').split(',')] | |||
bucket_sizes.append(max_length) | |||
elif os.getenv('TORCHACC_CACHE_PATH') is not None: # padding strategy when persistent cache is enabled | |||
p = 1.4 |
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.
Maybe we could add an environment variable for the p.
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.
Fixed.
swift/torchacc_utils.py
Outdated
@@ -30,6 +30,15 @@ def get_bucket_sizes(max_length: int) -> List[int]: | |||
if os.getenv('TORCHACC_DATA_BUCKETS') is not None: | |||
bucket_sizes = [int(x) for x in os.getenv('TORCHACC_DATA_BUCKETS').split(',')] | |||
bucket_sizes.append(max_length) | |||
elif os.getenv('TORCHACC_CACHE_PATH') is not None: # padding strategy when persistent cache is enabled |
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.
Could we replace the else
block with this logic as defualt bucketing strategy?
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.
Fixed.
65df450
to
7b22094
Compare
8f81c68
to
ebf50a2
Compare
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.
LGTM
ebf50a2
to
18c1674
Compare
…actor3 * commit '2bbc325ca789592197d2004bb0ffc47cc39c0317': (140 commits) fix fix update safe_ddp_context fix fix update row_processor support glm-edge & glm-edge-v (#2526) fix open-o1 support qwq-32b-preview (#2520) support mPLUG-Owl3 241101 (#2515) fix latex-ocr (#2510) support batch flattening collator (#2499) fix eval_dataset no (#2497) Support marco o1 (#2496) Fix preprocess num proc (#2492) fix awq quant device_map (#2488) Update Common QA (#2475) fix kto (#2478) update padding strategy for persistent cache (#2464) fix qwen2vl pt infer (#2463) ... # Conflicts: # docs/source/Instruction/命令行参数.md # docs/source/LLM/人类偏好对齐训练文档.md # docs/source/Multi-Modal/index.md # docs/source/Multi-Modal/qwen2-vl最佳实践.md # docs/source/Multi-Modal/人类偏好对齐训练文档.md # docs/source_en/Instruction/Command-line-parameters.md # docs/source_en/Instruction/Common-QA.md # docs/source_en/LLM/Human-Preference-Alignment-Training-Documentation.md # docs/source_en/Multi-Modal/qwen2-vl-best-practice.md
PR type
PR information
Optimize padding strategy when persistent cache is enabled, so we can enjoy performance boost with little extra compilaiton.
Experiment results
Around 10% e2e performance improvement for TorchAcc backend.