Skip to content

Conversation

KennethEnevoldsen
Copy link
Contributor

  • Move all implementations into a seperate folder called model_implementations
  • moved encoder_interface.py and model_meta.py into models
  • renamed models/* to encoder_implementions/* to make the distinction from between the two folder clear
  • merged models/utils.py into the only model that used it

We seems to have a few differing names when referring to a model (ModelMeta, get_model, etc.) and encoders (Encoder, AbsEncoder). Should we try to do something about this or just leave it as is?

Note: There is a few refactors that I would like to do on top of this, but will add that to seperate PR (since it is too hard to review here)

Fixes

- Move all implementations into a seperate folder called `model_implementations`
- moved `encoder_interface.py` and `model_meta.py` into `models`
- renamed `models/*` to `encoder_implementions/*` to make the distinction from between the two folder clear
- merged `models/utils.py` into the only model that used it

We seems to have a few differing names when referring to a model (ModelMeta, get_model, etc.) and encoders (Encoder, AbsEncoder). Should we try to do something about this or just leave it as is?

There is also an inconsistency between how tasks and implementations are in seperate folders, but for benchmark this is not the case.

We could convert it to:
```
benchmarks/tasks/models
| - implementations/*
| - ... # definitions utilities etc.
```
But I am not sure it is worth it and for tasks it might be too much nesting. So I would probably leave it as is.

Note: There is a few refactors that I would like to do on top of this, but will add that to seperate PR (since it is too hard to review here)

Fixes #2299
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reorganizes model-related code by moving implementation files into a dedicated model_implementations folder, relocating the encoder interface and metadata definitions under mteb/models, and updating all import paths accordingly.

  • All model implementations are now under mteb/models/model_implementations
  • encoder_interface.py and model_meta.py have been moved into mteb/models and imports throughout the codebase were updated
  • The helper module models/utils.py was removed in favor of inlining batching logic where needed

Reviewed Changes

Copilot reviewed 134 out of 135 changed files in this pull request and generated 1 comment.

File Description
tests/test_tasks/test_mteb_rerank.py Updated import of ModelMeta to new module location
scripts/generate_metadata.py Adjusted import path for ModelMeta, but left placeholder comment
mteb/models/model_meta.py Changed relative import for SIMILAR_TASKS
mteb/models/encoder_interface.py Removed Corpus type alias
Comments suppressed due to low confidence (2)

scripts/generate_metadata.py:11

  • [nitpick] The placeholder comment # <-- Replace with the actual import path is now outdated since the import has been corrected. Please remove or update the comment to reflect the current location of ModelMeta.
from mteb.models.model_meta import ModelMeta, ScoringFunction

mteb/models/encoder_interface.py:3

  • [nitpick] You removed the Corpus type alias. Verify that no existing references rely on Corpus; if there are, consider reintroducing the alias or updating those references accordingly.
from typing import Any, Protocol, runtime_checkable

@isaac-chung
Copy link
Collaborator

We seems to have a few differing names when referring to a model (ModelMeta, get_model, etc.) and encoders (Encoder, AbsEncoder). Should we try to do something about this or just leave it as is?

ModelMeta, get_model are separate things. What do you mean here?
Looks like AbsEncoder is a wrapper base class - maybe that can benefit from a better name?

@isaac-chung
Copy link
Collaborator

isaac-chung commented Jul 5, 2025

Move all implementations into a seperate folder called model_implementations
moved encoder_interface.py and model_meta.py into models
renamed models/* to encoder_implementions/* to make the distinction from between the two folder clear
merged models/utils.py into the only model that used it

  • Cannot find encoder_implementions. Do you mean model_implementations?
  • Instead of model_implementations, since it's within the models folder, can rename to just implementations?

Otherwise, looks good!

Copy link
Member

@Samoed Samoed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I think in future when we solve #2728 we can separate encoder implementation and cross-encoder (SearchInterface)

@KennethEnevoldsen
Copy link
Contributor Author

Yeah did mean model_implementations (used encoder implementations earlier)

So let us just leave the naming as is and then take a look at it later

@KennethEnevoldsen KennethEnevoldsen merged commit c0b01de into v2.0.0 Jul 5, 2025
9 checks passed
@KennethEnevoldsen KennethEnevoldsen deleted the KennethEnevoldsen/issue-v2-Move-wrappers-to-folder branch July 5, 2025 16:46
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 this pull request may close these issues.

3 participants