tsingmicro-toolchain/OnnxSlim

AttributeError: module 'onnxruntime' has no attribute 'set_default_logger_severity'

Opened this issue · 8 comments

Has anyone encountered it?
in init_logging
ort.set_default_logger_severity(3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'onnxruntime' has no attribute 'set_default_logger_severity'

Hi, can you provide your onnx and onnxruntime version

Hi, can you provide your onnx and onnxruntime version

onnx: version = "1.16.1"
onnxruntime: version = "1.18.0"
onnxslim: version = "0.1.32"
it's really strange, I used it well in the morning, but suddenly I reported an error in the afternoon,and the func “set_default_logger_severity” is in ort init.py
it doesn't work to reinstall onnxruntime and onnxslim, also reboot PC

Can you attach the output of the following command

pip list

Can you attach the output of the following command

pip list

Package Version Editable project location


absl-py 2.1.0
altgraph 0.17.4
bchlib 0.7
beautifulsoup4 4.12.3
boxmot 10.0.49 /home/cyq/Work/Inpainting_code/yolo_tracking-v10.0.50
Brotli 1.0.9
cachetools 5.3.3
certifi 2024.2.2
cfgv 3.4.0
charset-normalizer 3.1.0
coloredlogs 15.0.1
contourpy 1.1.1
cycler 0.12.1
distlib 0.3.8
easydict 1.13
filelock 3.14.0
filterpy 1.4.5
flatbuffers 24.3.25
fonttools 4.51.0
ftfy 6.2.0
gdown 4.6.3
gitdb 4.0.11
GitPython 3.1.43
google-auth 2.29.0
google-auth-oauthlib 1.0.0
grpcio 1.62.1
humanfriendly 10.0
identify 2.6.0
idna 3.7
imageio 2.34.1
imgcrop 0.1.0
imgviz 1.7.5
importlib_metadata 7.1.0
importlib_resources 6.4.0
joblib 1.4.2
kiwisolver 1.4.5
kornia 0.7.2
kornia_rs 0.1.3
labelme 5.4.1
lapx 0.5.9.post1
lazy_loader 0.4
loguru 0.7.2
lpips 0.1.4
Markdown 3.6
markdown-it-py 3.0.0
MarkupSafe 2.1.5
matplotlib 3.7.5
mdurl 0.1.2
mkl-fft 1.3.8
mkl-random 1.2.4
mkl-service 2.4.0
mpmath 1.3.0
natsort 8.4.0
networkx 3.1
nodeenv 1.9.1
numpy 1.24.4
oauthlib 3.2.2
onnx 1.16.1
onnxruntime 1.18.0
onnxsim 0.4.36
onnxslim 0.1.32
opencv-python-headless 4.10.0.84
packaging 24.0
pandas 2.0.3
Pillow 9.0.1
pip 23.3.1
platformdirs 4.2.2
pre-commit 3.5.0
protobuf 5.26.1
psutil 5.9.8
pyasn1 0.6.0
pyasn1_modules 0.4.0
Pygments 2.18.0
pyinstaller 6.8.0
pyinstaller-hooks-contrib 2024.7
pyparsing 3.1.2
PyQt5 5.15.10
PyQt5-Qt5 5.15.2
PyQt5-sip 12.13.0
PySocks 1.7.1
python-dateutil 2.9.0.post0
pytz 2024.1
PyWavelets 1.4.1
PyYAML 6.0.1
QtPy 2.4.1
regex 2024.5.15
requests 2.31.0
requests-oauthlib 2.0.0
rich 13.7.1
rsa 4.9
scikit-image 0.21.0
scikit-learn 1.3.2
scipy 1.10.1
seaborn 0.13.2
setuptools 68.2.2
six 1.16.0
smmap 5.0.1
soupsieve 2.5
stn 1.0.1
sympy 1.12.1
tensorboard 2.14.0
tensorboard-data-server 0.7.2
termcolor 2.4.0
thop 0.1.1.post2209072238
threadpoolctl 3.5.0
tifffile 2023.7.10
torch 1.11.0
torch-tb-profiler 0.4.3
torchaudio 0.11.0
torchgeometry 0.1.2
torchstat 0.0.7
torchsummary 1.5.1
torchvision 0.12.0
tqdm 4.66.2
typing_extensions 4.11.0
tzdata 2024.1
urllib3 2.2.1
virtualenv 20.26.3
wcwidth 0.2.13
Werkzeug 3.0.2
wheel 0.41.2
yacs 0.1.8
zipp 3.18.1

Can you also attach your command and full log

Can you also attach your command and full log

(yolov8) (base) cyq@ubuntu-20:~/Work/Code/UNet-master$ onnxslim '/home/cyq/Work/Code/UNet-master/model.onnx' '/home/cyq/Work/Code/UNet-master/model_slim.onnx'
Traceback (most recent call last):
File "/home/cyq/.local/bin/onnxslim", line 8, in
sys.exit(main())
^^^^^^
File "/home/cyq/.local/lib/python3.11/site-packages/onnxslim/cli/_main.py", line 263, in main
slim(
File "/home/cyq/.local/lib/python3.11/site-packages/onnxslim/cli/_main.py", line 83, in slim
init_logging(verbose)
File "/home/cyq/.local/lib/python3.11/site-packages/onnxslim/utils.py", line 52, in init_logging
ort.set_default_logger_severity(3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'onnxruntime' has no attribute 'set_default_logger_severity'

I think you are using python from /home/cyq/.local/, you can try running

which pip

the path must be different.

I think you are using python from /home/cyq/.local/, you can try running

which pip

the path must be different.

I think there's something wrong with my environment variable, I activate the custom env but it use the base env, Many thanks!