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

Loading SentenceTransformer Model and _load_sbert_model in ColBERT class #64

Closed
BenoitHardier opened this issue Oct 14, 2024 · 5 comments

Comments

@BenoitHardier
Copy link

Hey, thanks for your work.
I am trying to finetuned a model based on OrdalieTech/Solon-embeddings-base-0.1.
like that:

 model = models.ColBERT(model_name_or_path="OrdalieTech/Solon-embeddings-base-0.1")

Unfortunatly, it seems that the _load_sbert_model should output both modules and module_kwargs (The SentenceTranformer doc seems wrong) .
I am not sure if it's related to the SentenceTransformer version but I am using the last one 3.2.0

I finally succeed to load solon changing the _load_sbert_model in colbert.py
It should be modified:

modules = super()._load_sbert_model(
and here
return [
module
for module in modules.values()
if isinstance(module, Transformer)
or isinstance(module, DenseSentenceTransformer)
]

Let me know, if I am doing something wrong or if my issue is useful.

Benoît HARDIER

@NohTow
Copy link
Collaborator

NohTow commented Oct 15, 2024

Hello,

Indeed, breaking changes were introduced in this commit of ST, hence why we fixed the version of sentence-transformers to the last version before 3.1 (sentence-transformers == 3.0.1).

The fix is indeed what you suggested and during my preliminary tests, it seemed to work fine, but I wanted to make sure there was no regression before doing a PR for the fix and bump the version of ST. I might do the PR in the next days if it becomes needed.
In the mean time, you can either use your own hacked version or use the 3.0.1 version if you do not need the latest change (e.g, ONNX backend if you are training on CPU)!

@NohTow
Copy link
Collaborator

NohTow commented Oct 15, 2024

Hello again,

I fixed the issue in #65 and now the training with the model from Ordalie works fine with ST 3.2.0!
I'll merge the PR during the day alongside with other improvements and bump the version of PyLate.
image

@BenoitHardier
Copy link
Author

Hey

Great, It's also working on my setup.

I will try to continue digging into the repo. (I am specially interested in training/fine-tuning french retrieval models)
I let you close the issue when you have merged the fix.

Benoît HARDIER

@NohTow
Copy link
Collaborator

NohTow commented Oct 15, 2024

Cool!
We are also working on French models right now (on est une entreprise française à la base), hopefully we'll have cool things for you very soon!

@NohTow
Copy link
Collaborator

NohTow commented Oct 17, 2024

Closing since the PR has been merged.

@NohTow NohTow closed this as completed Oct 17, 2024
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