Skip to content

[Feature Request] Batch Encoding of Queries #2270

@kaushikacharya

Description

@kaushikacharya

In https://github.com/castorini/pyserini/blob/master/pyserini/encode/_auto.py
though AutoDocumentEncoder allows batch encoding, but AutoQueryEncoder encodes one query at a time.

This forces FaissSearcher # batch_search function to encode one query at a time

q_embs = [_enc(q) for q in queries]

def _enc(q):
    if isinstance(q, dict):
        return self.query_encoder.encode(**q)
    assert isinstance(q, str)
    return self.query_encoder.encode(q)
q_embs = [_enc(q) for q in queries]

Allowing batch encoding for queries would improve performance of batch_search

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions