Skip to content

Commit

Permalink
Fix error message in debugging environment
Browse files Browse the repository at this point in the history
Signed-off-by: Kyunggeun Lee <[email protected]>
  • Loading branch information
quic-kyunggeu committed Jan 23, 2025
1 parent 23f3a3a commit fe6ab4b
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@ def _convert_to_qmodule(module: torch.nn.Module):
Helper function to convert all modules to quantized aimet.nn modules.
"""
if not isinstance(module, (*quantized_modules, *unquantizable_modules, *containers)):
qmodule = None
try:
module = QuantizationMixin.from_module(module)
qmodule = QuantizationMixin.from_module(module)
module = qmodule
except RuntimeError as e:
try:
module = _legacy_impl.FakeQuantizationMixin.from_module(module)
qmodule = _legacy_impl.FakeQuantizationMixin.from_module(module)
module = qmodule
except RuntimeError:
if not tuple(module.children()):
raise e # pylint: disable=raise-missing-from
pass

if not qmodule and not tuple(module.children()):
raise e # pylint: disable=raise-missing-from

for name, child in module.named_children():
setattr(module, name, _convert_to_qmodule(child))
Expand Down

0 comments on commit fe6ab4b

Please sign in to comment.