BGE-M3 compute_score hangs on a single pair with multiple devices
BGEM3FlagModel.compute_score accepts a single (query, passage) pair, as its type hint Union[List[Tuple[str, str]], Tuple[str, str]] says. On one device this works because compute_score_single_device wraps the pair. With more than one device, compute_score passes the bare tuple to compute_score_multi_process, which iterates over it, so each worker receives the query string or the passage string as a "pair".
Repro (CPU only, two processes):
from FlagEmbedding import BGEM3FlagModel
if __name__ == "__main__":
pair = ("what is BGE M3?", "BGE M3 is an embedding model supporting dense, sparse and multi-vector retrieval.")
model = BGEM3FlagModel("BAAI/bge-m3", devices=["cpu", "cpu"], use_fp16=False)
print(model.compute_score(pair))
The worker fails, and the parent then waits forever on the output queue:
File ".../FlagEmbedding/inference/embedder/encoder_only/m3.py", line 591, in _compute_score_multi_process_worker
embeddings = model.compute_score_single_device(
File ".../FlagEmbedding/inference/embedder/encoder_only/m3.py", line 668, in compute_score_single_device
corpus_batch = [pair[1] for pair in sentences_batch]
IndexError: list index out of range
With devices="cpu" the same call returns a dict with one float per mode. Expected: the same result on several devices. AbsReranker.compute_score and AbsEmbedder.encode already handle a single input before dispatching to the pool; only the M3 compute_score path misses it.
Environment: master (current HEAD), Python 3.13, torch CPU, transformers 5.19.0.