Skip to content

Commit c4d030d

Browse files
authored
Fix the missing temporary name (#1029)
Signed-off-by: yiliu30 <[email protected]>
1 parent 2fb3ee1 commit c4d030d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

auto_round/compressors/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,13 +1551,15 @@ def quantize(self) -> tuple[torch.nn.Module, dict[str, Any]]:
15511551
Returns:
15521552
The quantized model and layer configurations.
15531553
"""
1554-
for n, m in self.model.named_modules(): # TODO check if could removed
1555-
m.tmp_name = n
1554+
15561555
self._check_compatibility()
15571556
formats = self.formats if hasattr(self, "formats") else None
15581557
# It is best to modify the model structure in the quantize function and check the format,
15591558
# because it may cause the gguf format to not be exported normally.
15601559
self.model = _handle_moe_model(self.model, formats=formats)
1560+
# Assign temporary names after replacing modules
1561+
for n, m in self.model.named_modules(): # TODO check if could removed
1562+
m.tmp_name = n
15611563

15621564
# TODO check scale_dtype
15631565
if not self.is_auto_scheme:

0 commit comments

Comments
 (0)