the report() method of Quantizer
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 850
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 10
Description
## ❓Question
```
my envs:
ubuntu 20.04
coremltools 7.0b1
pytorch 1.13
```
I followed the official documentation for **qat** training, and when I called the report() method of Quantizer, it reported an error:
```
Traceback (most recent call last):
File "tools/train.py", line 201, in
main()
File "tools/train.py", line 198, in main
worker(0, cfg)
File "tools/train.py", line 145, in worker
train(model, datasets, cfg)
File "tools/train.py", line 117, in train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/data/home/user3/cyx/deepediting/edit/core/runner/epoch_based_runner.py", line 130, in run
epoch_runner(data_loaders[0])
File "/data/home/user3/cyx/deepediting/edit/core/runner/epoch_based_runner.py", line 64, in train
self.call_hook('after_train_epoch')
File "/data/home/user3/cyx/deepediting/edit/core/runner/base_runner.py", line 203, in call_hook
getattr(hook, fn_name)(self)
File "/data/home/user3/cyx/deepediting/edit/core/hook/checkpoint/checkpoint.py", line 36, in after_train_epoch
runner.save_checkpoint(self.out_dir)
File "/data/home/user3/cyx/deepediting/edit/core/runner/epoch_based_runner.py", line 201, in save_checkpoint
self.convert_onnx()
File "/data/home/user3/cyx/deepediting/edit/core/runner/base_runner.py", line 282, in convert_onnx
print(self.quantizers[idx].report())
File "/home/user3/.conda/envs/cyx_torch_1.13/lib/python3.8/site-packages/coremltools/optimize/torch/quantization/quantizer.py", line 255, in report
module_summary["min_v"] = _torch.min(observer.min_val).item()
RuntimeError: min(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.
```
and the reason is 'module.weight_fake_quant.activation_post_process.min_val' 's numel() == 0, thus it is a empty tensor.
May I ask what is the reason for this situation?
Contributor guide
Assessment
This issue has not been assessed yet.