AttributeError: 'int' object has no attribute 'clone'`
ChenMathilda opened this issue · 4 comments
Hi,
When I try to quantify my model, I meet the follow Error. I don't know why I encountered such a problem. I used torch == 1.5.0, torch vision = = 0
CUDA not available: loaded checkpoint on cpu
Failed to find the [state_dict] inside the checkpoint. I will try to open it as a checkpoint.
self.filenames 6855
self.labels: 6855
self.types: 6855
Test: 100%|███████████████████████████████████████████████████████████████████████████████████████████| 215/215 [00:09<00:00, 21.90it/s, mse=0.34, acc=0.791]
Full precision MSE: 0.3403 , Acc: 0.7913, Model size: 1278.00kB
/home/Mathilda/anaconda3/envs/pulp-dronet-v2/lib/python3.8/site-packages/torch/nn/modules/module.py:548: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
result = self._slow_forward(*input, **kwargs)
Test: 100%|███████████████████████████████████████████████████████████████████████████████████████████| 215/215 [00:09<00:00, 23.41it/s, mse=0.34, acc=0.791]
FakeQuantized MSE: 0.3403 , Acc: 0.7913, Model size: 283.00kB
Test: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 215/215 [00:12<00:00, 17.11it/s, mse=0.248, acc=0.778]
QuantizedDeployable MSE: 0.2477 , Acc: 0.7781, Model size: 283.00kB
Test: 0%| | 0/215 [00:00<?, ?it/s]
Traceback (most recent call last):
File "quantize.py", line 329, in <module>
test_mse, test_acc = testing_nemo(model_q, test_loader, device, id_stage=True)
File "quantize.py", line 173, in testing_nemo
outputs = model(inputs)
File "/home/Mathilda/anaconda3/envs/pulp-dronet-v2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/Mathilda/pulp-dronet/pulp-dronet-v2/nemo-dory/../model/dronet_v2_nemo_dory.py", line 159, in forward
x = self.resBlock2(x)
File "/home/Mathilda/anaconda3/envs/pulp-dronet-v2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/Mathilda/pulp-dronet/pulp-dronet-v2/nemo-dory/../model/dronet_v2_nemo_dory.py", line 58, in forward
x = self.relu2(x)
File "/home/Mathilda/anaconda3/envs/pulp-dronet-v2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/Mathilda/pulp-dronet/nemo/nemo/quant/pact.py", line 647, in forward
x_rq = pact_integer_requantize(x, self.eps_in, self.eps_out, self.D)
File "/home/Mathilda/pulp-dronet/nemo/nemo/quant/pact.py", line 53, in pact_integer_requantize
D = D.clone().detach().to(eps_in.device)
**AttributeError: 'int' object has no attribute 'clone'**```
Regards,
Mathilda
@LorenzoLamberti94 I think you already solved this problem, right? maybe pulp-dronet is pointing to the wrong version of nemo.
@LorenzoLamberti94 I think you already solved this problem, right? maybe pulp-dronet is pointing to the wrong version of nemo.
I have successfully quantified the DroNet model in December 2021, and this problem did not appear at that time.
I only modified the code of DroNet.
hi chen
try this fork, i still need to merge.
https://github.com/LorenzoLamberti94/nemo
I should have fixed the problem in this commit: LorenzoLamberti94@fe10a0e
hi chen try this fork, i still need to merge. https://github.com/LorenzoLamberti94/nemo
I should have fixed the problem in this commit: LorenzoLamberti94@fe10a0e
Hi,
Thanks for your reply!
This error has been solved!