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
demo脚本:
报错提示: