zhutmost / lsq-net

Unofficial implementation of LSQ-Net, a neural network quantization framework
MIT License
276 stars 40 forks source link

TypeError: Conv2d._conv_forward() missing 1 required positional argument: 'bias' #19

Open rahulxie opened 2 years ago

rahulxie commented 2 years ago

python main.py config.yaml INFO - Log file for this run: /home/itl/Documents/xrh/lsq-net/out/MyProject_20220505-162725/MyProject_20220505-162725.log INFO - TensorBoard data directory: /home/itl/Documents/xrh/lsq-net/out/MyProject_20220505-162725/tb_runs Files already downloaded and verified Files already downloaded and verified INFO - Dataset cifar10 size: Training Set = 47500 (743) Validation Set = 2500 (40) Test Set = 10000 (157) INFO - Created resnet20 model for cifar10 dataset Use pre-trained model = True Traceback (most recent call last): File "/home/itl/Documents/xrh/lsq-net/main.py", line 119, in main() File "/home/itl/Documents/xrh/lsq-net/main.py", line 58, in main tbmonitor.writer.add_graph(model, input_to_model=train_loader.dataset[0][0].unsqueeze(0)) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/utils/tensorboard/writer.py", line 736, in add_graph self._get_file_writer().add_graph(graph(model, input_to_model, verbose, use_strict_trace)) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/utils/tensorboard/_pytorch_graph.py", line 291, in graph trace = torch.jit.trace(model, args, strict=use_strict_trace) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/jit/_trace.py", line 741, in trace return trace_module( File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/jit/_trace.py", line 958, in trace_module module._c._create_method_from_trace( File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, kwargs) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1098, in _slow_forward result = self.forward(*input, *kwargs) File "/home/itl/Documents/xrh/lsq-net/model/resnet_cifar.py", line 120, in forward out = F.relu(self.bn1(self.conv1(x))) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, kwargs) File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1098, in _slow_forward result = self.forward(*input, **kwargs) File "/home/itl/Documents/xrh/lsq-net/quan/func.py", line 25, in forward return self._conv_forward(quantized_act, quantized_weight) TypeError: Conv2d._conv_forward() missing 1 required positional argument: 'bias'

zhutmost commented 2 years ago

I have explained it in previous issues. PyTorch has modified its API in previous version.

fireworkk789 commented 1 year ago

Thanks for your work! I got the same issue as [rahulxie] and what exactly is the API modified by PyTorch that leads to this problem?