Error with sentence-transformers 5.6.1 and transformers 5.14.1

#1
by christian-winkler-th - opened

I cannot instantiate the model:

model_path = "geevec-ai/geevec-embeddings-1.0-lite"

# Load with trust_remote_code=True because the model defines custom modules.
model = SentenceTransformer(
    model_path,
    model_kwargs={"torch_dtype": torch.bfloat16},
    trust_remote_code=True,
)
Traceback (most recent call last):
  File "<python-input-1>", line 2, in <module>
    model = SentenceTransformer(
        model_path,
        model_kwargs={"dtype": torch.bfloat16},
        trust_remote_code=True,
    )
  File ".venv/lib/python3.14/site-packages/sentence_transformers/util/decorators.py", line 41, in wrapper
    return func(*args, **kwargs)
  File ".venv/lib/python3.14/site-packages/sentence_transformers/sentence_transformer/model.py", line 188, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        model_name_or_path=model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        default_prompt_name=default_prompt_name,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".venv/lib/python3.14/site-packages/sentence_transformers/base/model.py", line 216, in __init__
    modules, self.module_kwargs = self._load_modules(
                                  ~~~~~~~~~~~~~~~~~~^
        model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
        config_kwargs=config_kwargs,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".venv/lib/python3.14/site-packages/sentence_transformers/base/model.py", line 1002, in _load_modules
    return self._load_config_modules(model_name_or_path, **load_kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.14/site-packages/sentence_transformers/base/model.py", line 1208, in _load_config_modules
    module = module_class.load(
        model_name_or_path,
    ...<11 lines>...
        backend=self.backend,
    )
  File ".cache/huggingface/modules/transformers_modules/geevec_hyphen_ai/geevec_hyphen_embeddings_hyphen_1_dot_0_hyphen_lite/3c6073ded5dbe6eda5e8caed080400c61d5476b3/pseudo_moe_st_module.py", line 56, in load
    return PseudoMoETransformer(
        model_name_or_path=load_path,
    ...<3 lines>...
        trust_remote_code=trust_remote_code,
    )
  File ".cache/huggingface/modules/transformers_modules/geevec_hyphen_ai/geevec_hyphen_embeddings_hyphen_1_dot_0_hyphen_lite/3c6073ded5dbe6eda5e8caed080400c61d5476b3/pseudo_moe_st_module.py", line 31, in __init__
    self.auto_model = AutoModel.from_pretrained(
                      ~~~~~~~~~~~~~~~~~~~~~~~~~^
        model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^
        trust_remote_code=trust_remote_code,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        **model_args,
        ^^^^^^^^^^^^^
    )
    ^
  File ".venv/lib/python3.14/site-packages/transformers/models/auto/auto_factory.py", line 402, in from_pretrained
    return model_class.from_pretrained(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".venv/lib/python3.14/site-packages/transformers/modeling_utils.py", line 4412, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
  File ".cache/huggingface/modules/transformers_modules/geevec_hyphen_ai/geevec_hyphen_embeddings_hyphen_1_dot_0_hyphen_lite/3c6073ded5dbe6eda5e8caed080400c61d5476b3/modeling_qwen3_pseudo_moe.py", line 108, in __init__
    self.post_init()
    ~~~~~~~~~~~~~~^^
  File ".venv/lib/python3.14/site-packages/transformers/modeling_utils.py", line 1434, in post_init
    self.all_tied_weights_keys = self.get_expanded_tied_weights_keys(all_submodels=False)
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.14/site-packages/transformers/modeling_utils.py", line 2704, in get_expanded_tied_weights_keys
    if all(common_case_regex.match(k) for k in tied_mapping.keys() | tied_mapping.values()):
                                               ^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'keys'

Please try transformers==4.57.1. You can refer to this: https://github.com/embeddings-benchmark/results/pull/530#issuecomment-4419041562.

Sign up or log in to comment