You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to export my trained model into int8 by calling convert_and_export_predictor_method, I run into the following issue: TypeError: 'bool' object is not iterable
Reference code:
`import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch
File ~\anaconda3\envs\capstone_3\lib\site-packages\torch\ao\quantization\fuser_method_mappings.py:129, in get_fuser_method(op_list, additional_fuser_method_mapping)
127 if additional_fuser_method_mapping is None:
128 additional_fuser_method_mapping = dict()
--> 129 all_mappings = get_combined_dict(DEFAULT_OP_LIST_TO_FUSER_METHOD,
130 additional_fuser_method_mapping)
131 fuser_method = all_mappings.get(op_list, None)
132 assert fuser_method is not None, "did not find fuser method for: {} ".format(op_list)
File ~\anaconda3\envs\capstone_3\lib\site-packages\torch\ao\quantization\utils.py:12, in get_combined_dict(default_dict, additional_dict)
10 def get_combined_dict(default_dict, additional_dict):
11 d = default_dict.copy()
---> 12 d.update(additional_dict)
13 return d
TypeError: 'bool' object is not iterable
Before running into this issue, I had also faced another problem in fuse_utils.py which I overcame by making this change:
if fuser_method is None or mod_list[0].training:
#return fuse_known_modules(mod_list, is_qat=is_qat) -> old code
return fuse_known_modules(mod_list, is_qat)
After this change, I run into the bool object not iterable issue.
My analysis:
fuse_known_modules(mod_list, is_qat) -> here is_qat is false
Hi,
When I try to export my trained model into int8 by calling convert_and_export_predictor_method, I run into the following issue: TypeError: 'bool' object is not iterable
Reference code:
`import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch
import logging
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)
patch_d2_meta_arch()
pytorch_model = runner.build_model(cfg, eval_only=True)
pytorch_model.cpu()
datasets = cfg.DATASETS.TRAIN[0]
data_loader = runner.build_detection_test_loader(cfg, datasets)
predictor_path = convert_and_export_predictor(
copy.deepcopy(cfg),
copy.deepcopy(pytorch_model),
"torchscript_int8@tracing",
'./',
data_loader
)
logging.disable(previous_level)`
Issue seen:
File ~\anaconda3\envs\capstone_3\lib\site-packages\torch\ao\quantization\fuser_method_mappings.py:129, in get_fuser_method(op_list, additional_fuser_method_mapping)
127 if additional_fuser_method_mapping is None:
128 additional_fuser_method_mapping = dict()
--> 129 all_mappings = get_combined_dict(DEFAULT_OP_LIST_TO_FUSER_METHOD,
130 additional_fuser_method_mapping)
131 fuser_method = all_mappings.get(op_list, None)
132 assert fuser_method is not None, "did not find fuser method for: {} ".format(op_list)
File ~\anaconda3\envs\capstone_3\lib\site-packages\torch\ao\quantization\utils.py:12, in get_combined_dict(default_dict, additional_dict)
10 def get_combined_dict(default_dict, additional_dict):
11 d = default_dict.copy()
---> 12 d.update(additional_dict)
13 return d
TypeError: 'bool' object is not iterable
Before running into this issue, I had also faced another problem in fuse_utils.py which I overcame by making this change:
After this change, I run into the bool object not iterable issue.
My analysis:
fuse_known_modules(mod_list, is_qat) -> here is_qat is false
def fuse_known_modules(mod_list, additional_fuser_method_mapping=None):
fuser_method = get_fuser_method(types, additional_fuser_method_mapping)
additional_fuser_method_mapping is false now as it is is_qat from the call stack.
get_fuser_method calls this function:
all_mappings = get_combined_dict(DEFAULT_OP_LIST_TO_FUSER_METHOD,
additional_fuser_method_mapping)
def get_combined_dict(default_dict, additional_dict):
d = default_dict.copy()
d.update(additional_dict)
return d
Since additional_dict is additional_fuser_method_mapping which is false (a boolean), I ran into this problem.
The text was updated successfully, but these errors were encountered: