Commit 6f18490
authored
Improve AWQ init speed (#748)
## What does this PR do?
**Type of change:** ?Improvement<!-- Use one of the following: Bug fix,
new feature, new example, new tests, documentation. -->
**Overview:**
Improve speed of accessing weight through
enable_weight_access_and_writeback in AWQ helper init. This change
reduces the time complexity from O(num_modules^2) to O(num_modules) and
the runtime from ~1hour to 30 seconds.
## Usage
<!-- You can potentially add a usage example below. -->
```python
# Add a code snippet demonstrating how to use this
```
## Testing
<!-- Mention how have you tested your change if applicable. -->
python hf_ptq.py --pyt_ckpt_path
/home/scratch.omniml_data_1/models/qwen/Qwen3-30B-A3B-Instruct-2507
--qformat int4_awq
## Before your PR is "*Ready for review*"
<!-- If you haven't finished some of the above items you can still open
`Draft` PR. -->
- **Make sure you read and follow [Contributor
guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)**
and your commits are signed.
- **Is this change backward compatible?**: Yes/No <!--- If No, explain
why. -->
- **Did you write any new necessary tests?**: Yes/No
- **Did you add or update any necessary documentation?**: Yes/No
- **Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**:
Yes/No <!--- Only for new features, API changes, critical bug fixes or
bw breaking changes. -->
## Additional Information
<!-- E.g. related issue. -->
Signed-off-by: weimingc <17592131+meenchen@users.noreply.github.com>1 parent 9c24e2c commit 6f18490
2 files changed
+40
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| 535 | + | |
| 536 | + | |
535 | 537 | | |
536 | 538 | | |
537 | | - | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
540 | 542 | | |
| |||
606 | 608 | | |
607 | 609 | | |
608 | 610 | | |
609 | | - | |
610 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
611 | 614 | | |
612 | 615 | | |
613 | 616 | | |
| |||
701 | 704 | | |
702 | 705 | | |
703 | 706 | | |
704 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
705 | 710 | | |
706 | | - | |
| 711 | + | |
707 | 712 | | |
708 | 713 | | |
709 | 714 | | |
| |||
793 | 798 | | |
794 | 799 | | |
795 | 800 | | |
796 | | - | |
| 801 | + | |
797 | 802 | | |
798 | 803 | | |
799 | 804 | | |
| |||
973 | 978 | | |
974 | 979 | | |
975 | 980 | | |
| 981 | + | |
| 982 | + | |
976 | 983 | | |
977 | 984 | | |
978 | 985 | | |
979 | 986 | | |
980 | 987 | | |
981 | 988 | | |
982 | 989 | | |
983 | | - | |
| 990 | + | |
984 | 991 | | |
985 | 992 | | |
986 | 993 | | |
| |||
1004 | 1011 | | |
1005 | 1012 | | |
1006 | 1013 | | |
1007 | | - | |
| 1014 | + | |
1008 | 1015 | | |
1009 | 1016 | | |
1010 | 1017 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
400 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
405 | | - | |
406 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
407 | 416 | | |
408 | 417 | | |
409 | 418 | | |
410 | | - | |
411 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
412 | 423 | | |
413 | 424 | | |
414 | 425 | | |
| |||
469 | 480 | | |
470 | 481 | | |
471 | 482 | | |
472 | | - | |
| 483 | + | |
473 | 484 | | |
474 | 485 | | |
475 | 486 | | |
476 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
477 | 494 | | |
478 | | - | |
| 495 | + | |
479 | 496 | | |
480 | 497 | | |
481 | 498 | | |
| |||
0 commit comments