Interfaces in v2 #2739
Replies: 2 comments 7 replies
-
I'm not sure I follow entirely, as I struggle to see the painpoint here. What if we have the following condition for cross encoders in model.encode? def encode(self, ...):
if isinstance(self.model, CrossEncoder),
self.model.predict(...) Would help a lot as well if you can share some links or code examples. I'm reading this file at the moment. |
Beta Was this translation helpful? Give feedback.
-
I agree. I think we should support cross-encoders only for reranking tasks. This could be included as part of #2728. I think encoders could be available only throught
I think it's even more complex. It should look more like this: import mteb
meta = mteb.get_model_meta("BAAI/bge-m3")
model = meta.load_model()
emb = model.encode(
DataLoader({"text": ["some text"]}), # we now require DataLoader[BatchedInput], but I think this example still invalid
task_name="we have to put this here"
)
emb.shape # (1024,) We might consider renaming We could offer helper functions to simplify testing and user-facing use cases. But within the core implementation, sticking with a current encode (or its new version with all parameters explicitly required).
That method is used specifically during |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hei @Samoed, @isaac-chung I had a look at the Encoder interface in v2. These are one of the big things to get right.
There are a few things that I currently want to examine
It seems like cross encoders isn't really compatible (e.g. calling .encode on a wrapped Sentence TRF cross encoder will result in a call to the .encode method which the cross encoder does not have. I would suggest splitting them up into two interfaces and also splitting up the wrapper into two wrappers. WDYT?
We can no longer do naive tests:
E.g., before a simple test of embedding sizes would look like:
I am not sure what the correct approach is here, but it seems like the current setup requires way too much setup to do a simple test. Any suggestions?
An option here is to define a utility function on the Protocol like:
Which you can then inherit. I am not sure what the best option is here though.
To be clear here, I am quite happy with the .encode in its flexibility and the fact that it standardizes so much of the codebase. I just want to give an extra thought to usability.
e.g. I am unsure when
combine_query_and_instruction
is required (I suspect it is not).Beta Was this translation helpful? Give feedback.
All reactions