Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom retrievers: common base type for EvaluateRetrieval's retriever param #84

Open
tstadel opened this issue Mar 21, 2022 · 3 comments

Comments

@tstadel
Copy link

tstadel commented Mar 21, 2022

The current design of EvaluateRetrieval is already supporting multiple different retrievers. See

def __init__(self, retriever: Union[Type[DRES], Type[DRFS], Type[BM25], Type[SS]] = None, k_values: List[int] = [1,3,5,10,100,1000], score_function: str = "cos_sim"):

However according to typings the supplied retrievers are limited to those implemented in BEIR. If we want to integrate BEIR in other tools (like e.g. haystack) a custom retriever is basically easy to implement (see deepset-ai/haystack#2333). This is due to the fact that all retrievers share a common interface of course. However the typings on EvaluateRetrieval do not account for this explicitly. A common abstract base class instead of a Tuple of all implemented retrievers would make this extensibility more comprehensive.

@thakur-nandan
Copy link
Member

Hi @tstadel,

Thank you for bringing up this issue. I agree with your point. Could you provide an implementation that you have in mind for a common abstract base class and provide a pull request for that? I can check and merge it in the future.

Also, happy to see BEIR integrated within haystack.

Kind Regards,
Nandan Thakur

@tstadel
Copy link
Author

tstadel commented Mar 24, 2022

Hey @NThakur20,

sure. I'll submit a PR in the next days.

@nathan-chappell
Copy link

Shouldn't the line:

Union[Type[DRES], Type[DRFS], Type[BM25], Type[SS]]

Be:

Union[DRES, DRFS, BM25, SS]

In the examples you use this code:

model = DRES(models.SentenceBERT("msmarco-roberta-base-ance-fristp"))
retriever = EvaluateRetrieval(model, score_function="dot")

In this case, model is not of type Type[DRES], it is of type DRES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants