QDucasse / nn_benchmark

🧠 Benchmark facility to train networks on different datasets for PyTorch/Brevitas
MIT License
24 stars 1 forks source link

Module <class 'brevitas.nn.quant_activation.QuantTanh'> not supported for export. #30

Open NIIICE opened 3 years ago

NIIICE commented 3 years ago

I'm trying to get QuantVGG11 by:

$ PYTORCH_JIT=1 python nn_benchmark/main.py --network QuantVGG11 --dataset CIFAR10 --epochs 3 --acq 4 --weq 4 --inq 8 --gpus 0 --onnx

then I got:

`2021-09-07 17:48:37,833 Saving checkpoint model to ./experiments/QuantVGG11_A4W4I8_20210907_173455/checkpoints/best.tar Traceback (most recent call last): File "nn_benchmark/main.py", line 13, in cli.main() File "/home/yanzhi/PycharmProjects/nn_benchmark/nn_benchmark/core/cli.py", line 148, in main self.trainer.export_onnx() File "/home/yanzhi/PycharmProjects/nn_benchmark/nn_benchmark/core/trainer.py", line 402, in export_onnx self.exporter.export_onnx(self.model, self.output_dir_path, File "/home/yanzhi/PycharmProjects/nn_benchmark/nn_benchmark/core/exporter.py", line 21, in export_onnx self.quant_export(model=model, output_dir_path=output_dir_path, File "/home/yanzhi/PycharmProjects/nn_benchmark/nn_benchmark/core/exporter.py", line 42, in quant_export bo.export_finn_onnx(module=model, File "/home/yanzhi/PycharmProjects/brevitas/src/brevitas/export/init.py", line 13, in export_finn_onnx return FINNManager.export(*args, **kwargs) File "/home/yanzhi/PycharmProjects/brevitas/src/brevitas/export/onnx/finn/manager.py", line 112, in export onnx_model = cls.export_onnx( File "/home/yanzhi/PycharmProjects/brevitas/src/brevitas/export/onnx/base.py", line 89, in export_onnx module.apply(cls.set_export_handler) File "/home/yanzhi/.virtualenvs/nn_benchmark/lib/python3.8/site-packages/torch/nn/modules/module.py", line 616, in apply module.apply(fn) File "/home/yanzhi/.virtualenvs/nn_benchmark/lib/python3.8/site-packages/torch/nn/modules/module.py", line 616, in apply module.apply(fn) File "/home/yanzhi/.virtualenvs/nn_benchmark/lib/python3.8/site-packages/torch/nn/modules/module.py", line 617, in apply fn(self) File "/home/yanzhi/PycharmProjects/brevitas/src/brevitas/export/onnx/finn/manager.py", line 95, in set_export_handler _set_layer_export_handler(cls, module) File "/home/yanzhi/PycharmProjects/brevitas/src/brevitas/export/base.py", line 114, in _set_layer_export_handler raise RuntimeError(f"Module {module.class} not supported for export.")

RuntimeError: Module <class 'brevitas.nn.quant_activation.QuantTanh'> not supported for export. ` How can I fix it?

QDucasse commented 2 years ago

Seeing this after a long time, sorry!! This seems to be an error related to Brevitas...

I don't plan on maintaining this repo I am sorry... I wrote a simple wrapper around Brevitas to conduct simple experiments with the base MLP examples FINN provided but do not mean to replace the examples themselves (https://github.com/Xilinx/finn-examples). I would advise you to ask your questions on the gitter channels or in the FINN/Brevitas repositories directly! As for your case in particular, I remember I could not make VGG/Mobilenet to work but planned on trying to port them later on (which eventually never happened). In conclusion, sorry but I cannot help you! :frowning_face: