Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kriscpu opened this issue Aug 3, 2024 · 3 comments

Comments

@kriscpu
Copy link

kriscpu commented Aug 3, 2024

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 <log_feedback_to_the_rknn_toolkit_dev_team.log> 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
Copy link

### 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
Copy link

eRaul commented Aug 23, 2024

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

@eRaul
Copy link

eRaul commented Aug 23, 2024

### 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'

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants