-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Crash when importing torch #1472
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
Comments
Just for reference, it works without pybind11 (see code). However, I want to use pybind11...
|
I can't reproduce with pybind11 2.5.0. If this is still an issue, please reopen! |
The issue seems to be fixed in 2.5.0. |
Thanks for confirming, @pasbi! |
we still have problem in 2.10.0 c++ code:
wrapper.py code is class Wrapper():
serviceId = "mmocr"
version = "backup.0"
'''
服务初始化
@param config:
插件初始化需要的一些配置,字典类型
key: 配置名
value: 配置的值
@return
ret: 错误码。无错误时返回0
'''
def wrapperInit(cls, config: {}) -> int:
import torch
print(config)
print("Initializing ..")
return 0
def wrapperFini(cls) -> int:
return 0 |
Hi I still can replicate that one in here: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
My application crashes when
pybind11::scoped_interpreter
is destructed after importingtorch
.Reproducible example code
Note that the import itself works like a charm.
In the real code, I am using torch and it does what it is supposed to do.
The crash occurs when
guard
goes out of scope, i.e., when it is destructed.I guess it's a double-free issue, however, I can't narrow down the problem in
torch
, I believe the problem is somewhere deep in its C-implementation. Importingtensorflow
,numpy
,matplotlib
and other modules does not make such trouble.I already asked in the gitter lobby, but I didn't get an answer.
The text was updated successfully, but these errors were encountered: