PaddlePaddle / RocketQA

🚀 RocketQA, dense retrieval for information retrieval and question answering, including both Chinese and English state-of-the-art models.
Apache License 2.0
767 stars 128 forks source link

拉取最新docker,跑demo脚本,提示CUDA不兼容,无法使用GPU #71

Open yuyaxiong opened 1 year ago

yuyaxiong commented 1 year ago

demo脚本:

import rocketqa

query_list = ["trigeminal definition"]
para_list = [
    "Definition of TRIGEMINAL. : of or relating to the trigeminal nerve.ADVERTISEMENT. of or relating to the trigeminal nerve. ADVERTISEMENT."]

# init dual encoder
dual_encoder = rocketqa.load_model(model="v1_marco_de", use_cuda=True, device_id=0, batch_size=16)

# encode query & para
q_embs = dual_encoder.encode_query(query=query_list)
p_embs = dual_encoder.encode_para(para=para_list)
# compute dot product of query representation and para representation
dot_products = dual_encoder.matching(query=query_list, para=para_list)

报错提示:

λ 1f7e2a779543 ~/download python client.py
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/usr/local/python3.7.0/lib/python3.7/site-packages/paddle/fluid/framework.py:312: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
  "You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default."
RocketQA model [v1_marco_de]
Traceback (most recent call last):
  File "client.py", line 8, in <module>
    dual_encoder = rocketqa.load_model(model="v1_marco_de", use_cuda=True, device_id=0, batch_size=16)
  File "/usr/local/python3.7.0/lib/python3.7/site-packages/rocketqa/rocketqa.py", line 120, in load_model
    encoder = DualEncoder(**encoder_conf)
  File "/usr/local/python3.7.0/lib/python3.7/site-packages/rocketqa/encoder/dual_encoder.py", line 63, in __init__
    place = dev_list[device_id]
IndexError: list index out of range
procedure2012 commented 1 year ago

看着像是没有识别出gpu,可以先确认一下cuda和cudnn之类的是不是能争取识别gpu