inisis / brocolli

Everything in Torch Fx
MIT License
341 stars 63 forks source link

关于ptq_example的问题 #56

Closed Tyler-ytr closed 1 year ago

Tyler-ytr commented 1 year ago

当前的master分支的代码在运行ptq_example.py的时候会出现如下问题

Traceback (most recent call last):
  File "/home/p4ai/model_test/test/brocolli/ptq_example_402.py", line 126, in <module>
    pytorch_quantizer.convert()
  File "/home/p4ai/model_test/test/brocolli/brocolli/quantization/quantizer.py", line 359, in convert
    quantized = Linear.from_float(module)
  File "/home/p4ai/model_test/test/brocolli/brocolli/quantization/quantization_layers/linear.py", line 55, in from_float
    qlinear.act_scale = torch.Tensor(act_scale).to(qweight.device)
IndexError: slice() cannot be applied to a 0-dim tensor.

环境为python 3.9;使用cpu;pytorch版本为1.9.0+cu102;

inisis commented 1 year ago

这是一个bug,解决办法我建议直接把torch.Tensor删除。