Closed xxllp closed 5 months ago
I0312 11:07:43.887332 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887368 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887401 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887435 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887468 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887503 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887536 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887570 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887603 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887638 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887670 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887704 140542321780544 tensor_quantizer.py:184] Disablequantstage. Disablequantstage. I0312 11:07:43.887737 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator 0it [00:00, ?it/s] Traceback (most recent call last): File "pytorch_yolov5_ptq.py", line 135, in <module> collect_stats(q_model, dataloader) File "pytorch_yolov5_ptq.py", line 51, in collect_stats for i, image in tqdm(enumerate(data_loader)): File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/tqdm/std.py", line 1178, in __iter__ for obj in iterable: File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__ data = self._next_data() File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch return self.collate_fn(data) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 64, in default_collate return default_collate([torch.as_tensor(b) for b in batch]) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: stack expects each tensor to be equal size, but got [3, 426, 640] at entry 0 and [3, 640, 615] at entry 1 这个报错我太理解
I0312 11:07:43.887332 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887368 140542321780544 tensor_quantizer.py:184] Disable
stage. Disable
stage. I0312 11:07:43.887401 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887435 140542321780544 tensor_quantizer.py:184] Disable
stage. I0312 11:07:43.887468 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887503 140542321780544 tensor_quantizer.py:184] Disable
stage. I0312 11:07:43.887536 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887570 140542321780544 tensor_quantizer.py:184] Disable
stage. I0312 11:07:43.887603 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887638 140542321780544 tensor_quantizer.py:184] Disable
stage. I0312 11:07:43.887670 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887704 140542321780544 tensor_quantizer.py:184] Disable
stage. I0312 11:07:43.887737 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator 0it [00:00, ?it/s] Traceback (most recent call last): File "pytorch_yolov5_ptq.py", line 135, in <module> collect_stats(q_model, dataloader) File "pytorch_yolov5_ptq.py", line 51, in collect_stats for i, image in tqdm(enumerate(data_loader)): File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/tqdm/std.py", line 1178, in __iter__ for obj in iterable: File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__ data = self._next_data() File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch return self.collate_fn(data) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 64, in default_collate return default_collate([torch.as_tensor(b) for b in batch]) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: stack expects each tensor to be equal size, but got [3, 426, 640] at entry 0 and [3, 640, 615] at entry 1
感觉是输入维度不匹配,但是我这边校准集用的是验证集,构建dataloader时输入的尺寸也是640*640,遇到同样的错误
I0312 11:07:43.887332 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887368 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887401 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887435 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887468 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887503 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887536 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887570 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887603 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887638 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887670 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator I0312 11:07:43.887704 140542321780544 tensor_quantizer.py:184] Disable
quantstage. Disable
quantstage. I0312 11:07:43.887737 140542321780544 tensor_quantizer.py:180] Enable MaxCalibrator Enable MaxCalibrator 0it [00:00, ?it/s] Traceback (most recent call last): File "pytorch_yolov5_ptq.py", line 135, in <module> collect_stats(q_model, dataloader) File "pytorch_yolov5_ptq.py", line 51, in collect_stats for i, image in tqdm(enumerate(data_loader)): File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/tqdm/std.py", line 1178, in __iter__ for obj in iterable: File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__ data = self._next_data() File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch return self.collate_fn(data) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 64, in default_collate return default_collate([torch.as_tensor(b) for b in batch]) File "/root/anaconda3/envs/mjj_py377/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: stack expects each tensor to be equal size, but got [3, 426, 640] at entry 0 and [3, 640, 615] at entry 1
这个报错我太理解