Cannot import name ‘cuda_ext’ from partially initialized module ‘pytorch_quantization’

I am trying the pytorch-quantization (TensorRT/tools/pytorch-quantization at release/10.3 · NVIDIA/TensorRT · GitHub), and encountered a problem, hope some one can give me some advice on fixing it.

pytorch_quantization version: release/10.3

Installation from source code:
git clone GitHub - NVIDIA/TensorRT: NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
cd TensorRT/tools/pytorch-quantization
python setup.py install

Running:
python -c “import pytorch_quantization”

Report following error:
Traceback (most recent call last):
File “”, line 1, in
File “/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/init.py”, line 20, in
from .quant_modules import *
File “/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/quant_modules.py”, line 23, in
from pytorch_quantization import nn as quant_nn
File “/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/nn/init.py”, line 19, in
from pytorch_quantization.nn.modules.tensor_quantizer import *
File “/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/nn/modules/tensor_quantizer.py”, line 24, in
from pytorch_quantization.tensor_quant import QuantDescriptor, tensor_quant, fake_tensor_quant, scaled_e4m3
File “/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/tensor_quant.py”, line 28, in
from pytorch_quantization import cuda_ext
ImportError: cannot import name ‘cuda_ext’ from partially initialized module ‘pytorch_quantization’ (most likely due to a circular import) (/data/theoWS/nvidia-quant/TensorRT/tools/pytorch-quantization/pytorch_quantization/init.py)

What’s the problem and how to fix it? Thank you.

Hi @relaxtheo
This could be a issue from pytorch, would you mind checking on teh github page?

Thanks

this seems not the reason, you can close it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.