Skip to content

TypeError: swap_module() takes 3 positional arguments but 4 were given #289

@bruce1408

Description

@bruce1408

Hi,When I use the latest version, I encounter the following error, if i remove the last parameter, it can run normally. Is the ‘False’ here redundant? What variable does it control?

  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/Examples/mobilenet_v2/train_qat.py", line 144, in <module>
    model = prepare_by_platform(model, BackendType.Tensorrt, prepare_custom_config_dict)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/prepare_by_platform.py", line 429, in prepare_by_platform
    prepared = quantizer.prepare(graph_module, qconfig, is_qat, backend_config, freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 70, in prepare
    model = self._weight_quant(model, qconfig, backend_config, freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 131, in _weight_quant
    self._qat_swap_modules(model, self.additional_qat_module_mapping, backend_config, freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 258, in _qat_swap_modules
    root = self._convert(root, all_mappings, inplace=True, backend_config = backend_config, freeze_bn=freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 276, in _convert
    self._convert(mod, mapping, True, new_scope, freeze_bn= freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 276, in _convert
    self._convert(mod, mapping, True, new_scope, freeze_bn= freeze_bn)
  File "/mnt/share_disk/bruce_trie/workspace/Quantizer-Tools/MQBench/mqbench/custom_quantizer/model_quantizer.py", line 277, in _convert
    reassign[name] = swap_module(mod, mapping, {}, False)
TypeError: swap_module() takes 3 positional arguments but 4 were given

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions