You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
python -m pyserini.encode ^
input --corpus msmarco-passage-corpus/msmarco-passage-corpus.json ^
--fields title text ^
--delimiter "\n" ^
--shard-id 0 ^
--shard-num 1 ^
output --embeddings ./msmarco-passage-corpus/bpr ^
--to-faiss ^
encoder --encoder castorini/bpr-nq-ctx-encoder ^
--fields title text ^
--batch 32 ^
--fp16
When using the castorini/bpr-nq-ctx-encoder model for encoding with Pyserini, the following error occurs:
File "C:\Users\user\anaconda3\envs\pyserini_2\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user\anaconda3\envs\pyserini_2\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\user\anaconda3\envs\pyserini_2\lib\site-packages\pyserini\encode\__main__.py", line 151, in <module>
embeddings = encoder.encode(**kwargs)
File "C:\Users\user\anaconda3\envs\pyserini_2\lib\site-packages\pyserini\encode\_auto.py", line 69, in encode
embeddings = outputs[0][:, 0, :].detach().cpu().numpy()
IndexError: too many indices for tensor of dimension 2
This issue occurs because the tensor returned by the castorini/bpr-nq-ctx-encoder model has only two dimensions, while the current script assumes a three-dimensional tensor. This error does not occur with the DPR model because its output tensor matches the expected structure.
Proposed Fix
To make the script compatible with both BPR and DPR models, update the indexing logic in the _auto.py script.
i am trying to run the following Pyserini command
When using the
castorini/bpr-nq-ctx-encoder
model for encoding with Pyserini, the following error occurs:This issue occurs because the tensor returned by the
castorini/bpr-nq-ctx-encoder
model has only two dimensions, while the current script assumes a three-dimensional tensor. This error does not occur with the DPR model because its output tensor matches the expected structure.Proposed Fix
To make the script compatible with both BPR and DPR models, update the indexing logic in the
_auto.py
script.Current Code (Line 69):
update to the following
is my solution is correct?
The text was updated successfully, but these errors were encountered: