Accelergy-Project / pytorch2timeloop-converter

MIT License
10 stars 11 forks source link

A bug related to isinstance and issubclass #12

Closed MemMeta closed 9 months ago

MemMeta commented 1 year ago

I installed it with Ptyhon 3.7. Execution of the test cases under the test folder produces the following error message. In addition, I failed to install it if the Python 3.6 was used.

Traceback (most recent call last): File "tst.py", line 34, in

pytorch2timeloop.convert_model(net, input_shape, batch_size, sub_dir, top_dir, convert_fc, exception_module_names)

File "/mnt/raiddisk/jyue/Project/tmp/pytorch2timeloop-converter/pytorch2timeloop/converter_pytorch.py", line 79, in convert_model

layer_data = _make_summary(model, sample_input, ignored_func=ignored_func)

File "/mnt/raiddisk/jyue/Project/tmp/pytorch2timeloop-converter/pytorch2timeloop/converter_pytorch.py", line 114, in _make_summary

converter.run(sample_input)

File "/home/jyue/miniconda3/envs/myenv/lib/python3.7/site-packages/torch/fx/interpreter.py", line 130, in run

self.env[node] = self.run_node(node)

File "/mnt/raiddisk/jyue/Project/tmp/pytorch2timeloop-converter/pytorch2timeloop/utils/interpreter.py", line 88, in run_node

original_args)

File "/mnt/raiddisk/jyue/Project/tmp/pytorch2timeloop-converter/pytorch2timeloop/utils/interpreter.py", line 100, in call_module

if isinstance(module, self.bypassed_modules):

File "/home/jyue/miniconda3/envs/myenv/lib/python3.7/typing.py", line 716, in instancecheck

return self.__subclasscheck__(type(obj))

File "/home/jyue/miniconda3/envs/myenv/lib/python3.7/typing.py", line 724, in subclasscheck

raise TypeError("Subscripted generics cannot be used with"

TypeError: Subscripted generics cannot be used with class and instance checks

While executing %features_0 : [#users=1] = call_module[target=features.0](args = (%x,), kwargs = {})

Original traceback:

None

tanner-andrulis commented 9 months ago

Thank you. Now fixed in commit 078833b