ModelTC / MQBench

Model Quantization Benchmark
Apache License 2.0
752 stars 136 forks source link

ImportError: cannot import name 'ConvBNReLUFusion' from 'torch.quantization.fx.fusion_patterns' #268

Open huangweiwh opened 5 months ago

huangweiwh commented 5 months ago

When I try to ptq mobilenetv2, I get an error: "ImportError: cannot import name 'ConvBNReLUFusion' from 'torch.quantization.fx.fusion_patterns'"

corin-lyz commented 4 months ago

Have you solved this problem? I also encountered this problem

wuchangli commented 2 months ago

torch==1.10.0 has this, but the newest torch removed it. How do adapt it to the newest torch?

ardeal commented 1 month ago

I am able to solve this problem. 1) if you install torch 1.10.0, you are not able to install other related packages. 2) if you run MQBench on the latest torch, you are not able to import those mudules as which is removed by Pytorch.

I have already update this module and run it on the latest torch. The quantization accuracy is also good.

bieyl commented 1 week ago

@ardeal ImportError: cannot import name 'ConvBNReLUFusion' from 'torch.quantization.fx.fusion_patterns' How do you sovle it? My torch version is 2.4.0, but i need to use the corresponding CUDA. So do you heve the good sollution?

bieyl commented 4 days ago

I am able to solve this problem.

  1. if you install torch 1.10.0, you are not able to install other related packages.
  2. if you run MQBench on the latest torch, you are not able to import those mudules as which is removed by Pytorch.

I have already update this module and run it on the latest torch. The quantization accuracy is also good.

Hello @ardeal ImportError: cannot import name 'ConvBNReLUFusion' from 'torch.quantization.fx.fusion_patterns' How do you sovle it? My torch version is 2.4.0, but i need to use the corresponding CUDA. So do you heve the good sollution?