rockchip-linux / rknn-toolkit

BSD 3-Clause "New" or "Revised" License
830 stars 175 forks source link

AttributeError: 'NoneType' object has no attribute 'FileHandler' while converting ONNX to RKNN #465

Open kriscpu opened 3 months ago

kriscpu commented 3 months ago

W rknn-toolkit version: 1.7.5 W Verbose file path is invalid, debug info will not dump to file. D Using CPPUTILS: True --> config model done --> Loading model I Start importing pytorch... ./models/best.onnx **** D import clients finished E Catch exception when loading pytorch model: ./models/best.onnx! E Traceback (most recent call last): E File "rknn/base/RKNNlib/converter/convert_pytorch_new.py", line 5227, in rknn.base.RKNNlib.converter.convert_pytorch_new.convert_pytorch.load E File "rknn/base/RKNNlib/converter/pytorch_util.py", line 76, in rknn.base.RKNNlib.converter.pytorch_util.check_model_pt_version E File "rknn/base/RKNNlib/converter/pytorch_util.py", line 77, in rknn.base.RKNNlib.converter.pytorch_util.check_model_pt_version E File "/home/kris/anaconda3/envs/rk/lib/python3.8/zipfile.py", line 1271, in init E self._RealGetContents() E File "/home/kris/anaconda3/envs/rk/lib/python3.8/zipfile.py", line 1338, in _RealGetContents E raise BadZipFile("File is not a zip file") E zipfile.BadZipFile: File is not a zip file E Please feedback the detailed log file to the RKNN Toolkit development team. E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues Load pytorch model failed! Exception ignored in: <function RKNN.del at 0x7f69d6705af0> Traceback (most recent call last): File "/home/kris/anaconda3/envs/rk/lib/python3.8/site-packages/rknn/api/rknn.py", line 781, in del AttributeError: 'NoneType' object has no attribute 'FileHandler' (rk) kris@ubuntu:~/Downloads/rknpu-master/rknn/rknn_api/examples/rknn_yolov5_demo/convert_rknn_demo/yolov5$

tutouyubeiyi commented 3 months ago

### I also encountered this problem when i try to precompile. (rknn toolkit 1.7.5)

(py3.8-rknntoolkit1.7.5) developer@EASY-EAI-Develop:~$ python precompile.py driver.rknn driver_precompile.rknn W rknn-toolkit version: 1.7.5 --> Loading RKNN model done --> Init runtime environment I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36) D RKNNAPI: ============================================== D RKNNAPI: RKNN VERSION: D RKNNAPI: API: 1.7.5 (bb79b30 build: 2023-06-20 09:54:19) D RKNNAPI: DRV: 1.7.3 (c4ea832 build: 2022-08-13 09:29:29) D RKNNAPI: ============================================== done Exception ignored in: <function RKNN.del at 0x7f0759909310> Traceback (most recent call last): File "/home/developer/miniconda3/envs/py3.8-rknntoolkit1.7.5/lib/python3.8/site-packages/rknn/api/rknn.py", line 781, in del AttributeError: 'NoneType' object has no attribute 'FileHandler'

eRaul commented 3 months ago

请使用load_onnx接口加载ONNX模型,load_pytorch接口加载的是torch script模型。

eRaul commented 3 months ago

### I also encountered this problem when i try to precompile. (rknn toolkit 1.7.5)

(py3.8-rknntoolkit1.7.5) developer@EASY-EAI-Develop:~$ python precompile.py driver.rknn driver_precompile.rknn W rknn-toolkit version: 1.7.5 --> Loading RKNN model done --> Init runtime environment I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36) D RKNNAPI: ============================================== D RKNNAPI: RKNN VERSION: D RKNNAPI: API: 1.7.5 (bb79b30 build: 2023-06-20 09:54:19) D RKNNAPI: DRV: 1.7.3 (c4ea832 build: 2022-08-13 09:29:29) D RKNNAPI: ============================================== done Exception ignored in: <function RKNN.del at 0x7f0759909310> Traceback (most recent call last): File "/home/developer/miniconda3/envs/py3.8-rknntoolkit1.7.5/lib/python3.8/site-packages/rknn/api/rknn.py", line 781, in del AttributeError: 'NoneType' object has no attribute 'FileHandler'

这个错误是最后退出脚本报的,可以不用管。