submission2019 / cnn-quantization

Quantization of Convolutional Neural networks.
237 stars 59 forks source link

NO module named 'int_quantization' #2

Closed chingandy closed 5 years ago

chingandy commented 5 years ago

After running this command python -m inference.inference_sim -a resnet50 -b 512 -sm use --qtype int4 -pcq_w -pcq_a -c laplace I got the error message as following: Traceback (most recent call last): File "inference/inference_sim.py", line 25, in <module> from pytorch_quantizer.quantization.inference.inference_quantization_manager import QuantizationManagerInference as QM File "/Users/chingandywu/master-thesis/cnn-quantization/inference/../pytorch_quantizer/quantization/inference/inference_quantization_manager.py", line 3, in <module> from pytorch_quantizer.quantization import qtypes File "/Users/chingandywu/master-thesis/cnn-quantization/inference/../pytorch_quantizer/quantization/qtypes/__init__.py", line 1, in <module> from .int_quantizer import int_quantizer File "/Users/chingandywu/master-thesis/cnn-quantization/inference/../pytorch_quantizer/quantization/qtypes/int_quantizer.py", line 4, in <module> import int_quantization ModuleNotFoundError: No module named 'int_quantization'

What can I do to solve this problem? I tried to run all this without CUDA because I don't have a GPU. As a result, I disabled the CUDA part in absorb_bn.py.

chingandy commented 5 years ago

I am not familiar with the CUDA toolkit, so I was wondering how to replicate all the experiments without the availability of a CUDA-supported GPU. Thank you in advance!

submission2019 commented 5 years ago

You can try disable CUDA dependency by:

  1. disable custom cuda kernel loading by commenting import in pytorch_quantizer/quantization/qtypes/init.py
  2. In int_quantizer.py replace all usages of gemmlowpQuantize by gemmlowpQuantize1

Then run regularly should execute on CPU instead of GPU. Note that I didn't tested this mode and running on CPU should take much more time than GPU so no guaranty.