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

小白请教ernie_skep_sentiment_analysis怎么指定使用那张显卡? #2333

Open
thehzzz opened this issue Jul 4, 2024 · 0 comments
Open
Assignees

Comments

@thehzzz
Copy link

thehzzz commented Jul 4, 2024

我有两张显卡,我在学习ernie_skep_sentiment_analysis预测代码示例:

import paddlehub as hub
module = hub.Module(name="ernie_skep_sentiment_analysis")

test_texts = ['你不是不聪明,而是不认真', '虽然小明很努力,但是他还是没有考100分']
results = module.predict_sentiment(test_texts, use_gpu=False)

for result in results:
print(result['text'])
print(result['sentiment_label'])
print(result['positive_probs'])
print(result['negative_probs'])

我想在代码示例中加入显卡指定,好像不能通过os.environ["CUDA_VISIBLE_DEVICES"]="1"来指定运行显卡。

另外我也尝试修改了model.py 中的
_places = os.environ["CUDA_VISIBLE_DEVICES"]
int(_places[0])

也不能指定显卡。

请问要怎么做才能够在预测代码示例中加入指定显卡?

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

2 participants