-
Notifications
You must be signed in to change notification settings - Fork 936
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
C# 两个线程不同时调用同一个模型推理报错,第一个线程用后,第二个线程无法使用? #1160
Comments
是否有初始化两个实例(比如初始化两个model, 一个线程使用一个model实例)? 多线程情况下,如果只有一个推理实例,一次只有一个线程能调用该实例(不能有多个线程访问同一个实例)。 |
两个线程一个model,但是线程1调用时,线程2不用。不会出现冲突的问题。有办法解决这个问题吗?不然调试起来太麻烦。因为我们自动运行是一个线程,调试是一个线程 |
您好,请问您这个问题解决了吗?我也遇到同样的问题。 |
@heliqi 按这个说法,意思是每个model得绑定到一个固定线程去吗?Code-WHappy的应用场景其实已经是单线程访问了,只不过是多个线程分时访问同一个模型,如果这样无法支持,就只能理解为一个model得绑定到一个线程了。 但这样就太方便了,多个线程分时访问的需求太多了,难道没有解决方案吗? |
还没有解决,官方还没给出解决方案 |
|
推荐使用这个pr里的线程池:#1179 对c++的dll接口进行封装,线程池使用参照multi_thread_infer2.cpp。 |
我看了下你们这个multi_thread_infer2.cpp,这是推理的时候多线程同时推理,然后再合并结果。我们需要的是,一个推理一个线程即可,但是需要在线程ID变化的情况下也能用。也就是说线程1调用后,线程2在调用也可以 |
你看错demo了吧? future2.get(); |
你好,我最近用多个线程调用不同的模型,但是还是会出现线程冲突的情况,我把model_infer.dll更改名字都不行。也已经实例化了多个model。引用代码如下:
推测model_infer.dll会引用paddle_inference.dll的网络,导致同时访问的时候冲突。 |
问题类型:其它
PaddleX版本
您使用的PaddleX版本
2.0.0
问题描述
如题
The text was updated successfully, but these errors were encountered: