Fix (brevitas_examples/imagenet/ptq): DataLoader fix #1420
Merged
nickfraser merged 3 commits intoXilinx:devfrom Nov 21, 2025
Merged
Fix (brevitas_examples/imagenet/ptq): DataLoader fix #1420nickfraser merged 3 commits intoXilinx:devfrom
nickfraser merged 3 commits intoXilinx:devfrom
Conversation
Collaborator
|
Thanks for the contribution, this looks good. I ran our linting locally ( Occasionally, we've had problems using Otherwise, I'll merge once the tests finish - thanks! |
nickfraser
approved these changes
Nov 21, 2025
Collaborator
nickfraser
left a comment
There was a problem hiding this comment.
LGTM (pending tests)
Collaborator
|
FYI, failing LLM tests are being addressed in #1415. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reason for this PR
ptq_evaluate.py was running too slowly on the GPU. It was caused by repeatedly loading the dataset into memory. This was mostly noticeable with enabled: GPTQ, GPFQ...
Changes Made in this PR
Increased speed of calibration by preserving the dataset in memory and avoiding unnecessary loading by adding
persistent_workers=Trueto DataLoader.Also added code to free the calibration dataset from memory before validation.
Testing Summary
Pre:
Starting activation calibration:
100%|█████| 16/16 [00:41<00:00, 2.59s/it]
Performing GPTQ:
100%|█████| 21/21 [11:50<00:00, 33.82s/it]
Applying bias correction:
100%|█████| 16/16 [00:34<00:00, 2.15s/it]
Starting validation:
100%|█████| 196/196 [00:56<00:00, 3.49it/s]
Total:Avg acc@1 63.724
Post:
Starting activation calibration:
100%|█████| 16/16 [00:10<00:00, 1.58it/s]
Performing GPTQ:
100%|█████| 21/21 [00:45<00:00, 2.16s/it]
Applying bias correction:
100%|█████| 16/16 [00:01<00:00, 9.43it/s]
Starting validation:
100%|█████| 196/196 [00:53<00:00, 3.67it/s]
Total:Avg acc@1 63.724
(tested on windows, default_template.yaml+ GPTQ + GPU)
Risk Highlight
Checklist
devbranch.