Skip to content

Newly added SparseEncoder required sentence-transformers>=5.0.0 #2936

@KennethEnevoldsen

Description

@KennethEnevoldsen

Describe the bug

The newly added SparseEncoder requires sentence-transformers>=5.0.0.

This seems to have been introduced here: #2903

@isaac-chung did you merge this accidentally?

A solution would be to only import SparseEncoder within the Wrapper function (as with other optional dependencies. I think this would be the cleanest approach.

To reproduce

install mteb with sentence-transformers>=3.0.0,<5.0.0

❯ python                 
Python 3.10.0 (default, Oct 17 2021, 11:56:26) [Clang 13.0.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mteb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/au561649/Github/mteb-worktree/mteb/__init__.py", line 5, in <module>
    from mteb.benchmarks.benchmarks import (
  File "/Users/au561649/Github/mteb-worktree/mteb/benchmarks/__init__.py", line 3, in <module>
    from mteb.benchmarks.benchmark import Benchmark
  File "/Users/au561649/Github/mteb-worktree/mteb/benchmarks/benchmark.py", line 9, in <module>
    from mteb.load_results.load_results import load_results
  File "/Users/au561649/Github/mteb-worktree/mteb/load_results/__init__.py", line 3, in <module>
    from .benchmark_results import BenchmarkResults, ModelResult
  File "/Users/au561649/Github/mteb-worktree/mteb/load_results/benchmark_results.py", line 16, in <module>
    from mteb.abstasks.AbsTask import AbsTask, ScoresDict
  File "/Users/au561649/Github/mteb-worktree/mteb/abstasks/__init__.py", line 3, in <module>
    from ..evaluation.LangMapping import *
  File "/Users/au561649/Github/mteb-worktree/mteb/evaluation/__init__.py", line 3, in <module>
    from .MTEB import *
  File "/Users/au561649/Github/mteb-worktree/mteb/evaluation/MTEB.py", line 22, in <module>
    from mteb.models import model_meta_from_sentence_transformers
  File "/Users/au561649/Github/mteb-worktree/mteb/models/__init__.py", line 5, in <module>
    from mteb.models.overview import (
  File "/Users/au561649/Github/mteb-worktree/mteb/models/overview.py", line 14, in <module>
    from mteb.models import (
  File "/Users/au561649/Github/mteb-worktree/mteb/models/opensearch_neural_sparse_models.py", line 8, in <module>
    from sentence_transformers.sparse_encoder import SparseEncoder
ModuleNotFoundError: No module named 'sentence_transformers.sparse_encoder'

Additional information

No response

Are you interested to contribute a fix for this bug?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions