Refactor module access to use PyTorch get_submodule / set_submodule#1590
Refactor module access to use PyTorch get_submodule / set_submodule#1590scopophobic wants to merge 5 commits intointel:mainfrom
Conversation
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@XuehaoSun Please help fix this CI issue. |
There was a problem hiding this comment.
Pull request overview
Refactors internal module/attribute access helpers to use PyTorch’s native dotted-path APIs (get_submodule / set_submodule) for more reliable resolution, while keeping legacy “missing path should not crash” behavior. Also relaxes layer-name collection to skip missing layers rather than terminating the process.
Changes:
- Add dedicated
get_attr/set_attrfor dotted attribute access (including parameter attributes like...weight) with “missing returns/no-op” behavior. - Refactor
get_module/set_moduleto useget_submodule/set_submodule, returningNone/ no-op on missing paths. - In
_get_quantized_layer_names_outside_blocks, skip missing layers with a one-time warning instead of exiting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
auto_round/utils/model.py |
Introduces get_attr/set_attr and switches module replacement to get_submodule/set_submodule while preserving non-fail-fast behavior. |
auto_round/compressors/base.py |
Avoids hard exit when a configured layer path is missing; logs and continues. |
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
hi @xin3he, following up on this... all CI tests are green. Please let me know if there’s anything else needed from my side to get this merged. Appreciate your time! |
@xin3he
Refactor module access to use PyTorch get_submodule / set_submodule for exact dotted module paths, while preserving prior “missing path should not crash” behavior by catching AttributeError/KeyError. This avoids CI failures caused by optional/missing submodules in some model variants.
Note: This is a new PR because I accidentally closed the previous one while iterating on the fix.
Type of Change: Bug fix / Refactor.