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

[v2] Updated ModelMeta parameters #1779

Open
Tracked by #1791
Samoed opened this issue Jan 12, 2025 · 1 comment
Open
Tracked by #1791

[v2] Updated ModelMeta parameters #1779

Samoed opened this issue Jan 12, 2025 · 1 comment

Comments

@Samoed
Copy link
Collaborator

Samoed commented Jan 12, 2025

Currently, the model annotation looks like this:

e5_mult_small = ModelMeta(
    loader=partial(  # type: ignore
        sentence_transformers_loader,
        model_name="intfloat/multilingual-e5-small",
        revision="fd1525a9fd15316a2d503bf26ab031a61d056e98",
        model_prompts=model_prompts,
    ),
    name="intfloat/multilingual-e5-small",
    revision="fd1525a9fd15316a2d503bf26ab031a61d056e98",
    ...
)

This causes code duplication with the model name and revision being repeated. I propose changing this to pass the model name and revision directly to the loader using get_model, as demonstrated [here](

mteb/mteb/model_meta.py

Lines 120 to 125 in 0c5c3a5

loader = partial(
sentence_transformers_loader,
model_name=self.name,
revision=self.revision,
**kwargs,
)
).

With this approach, ModelMeta could look like this:

e5_mult_small = ModelMeta(
    loader=sentence_transformers_loader,  # callable or class
    loader_kwargs={"model_prompts": model_prompts},  # dict with additional kwargs
    name="intfloat/multilingual-e5-small",
    revision="fd1525a9fd15316a2d503bf26ab031a61d056e98",
    ...
)
# model_meta.py
model = meta.loader(meta.name, meta.revision, similarity_fn_name=meta.similarity, **meta.loader_kwargs, **kwargs) 

This would reduce code duplication and make the implementation cleaner.

Issue discussion start #1759

@KennethEnevoldsen
Copy link
Contributor

Thanks for outlining it. I am perfectly fine with this case

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

No branches or pull requests

2 participants