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

SGPT support #1590

Closed
Muennighoff opened this issue Jun 12, 2022 · 13 comments
Closed

SGPT support #1590

Muennighoff opened this issue Jun 12, 2022 · 13 comments

Comments

@Muennighoff
Copy link
Contributor

Hey, would you merge a PR adding support for SGPT? I think I would just need to add a pooling method to Pooling.py.
Currently, using SGPT via the HF Inference API fails with __init__() got an unexpected keyword argument 'pooling_mode_weightedmean_tokens', because of the missing pooling method. I could also add it as a separate library to the HF Inf API, but I think it'd be much simpler to add the pooling method to this library.

@nreimers
Copy link
Member

Yes, I would be happy to merge such a PR

@sinaak
Copy link

sinaak commented Feb 16, 2023

@Muennighoff @nreimers
I still have the same issue, with Pytorch 1.12.2, cuda 10.2, and sentence-transformers 2.2.2. Im trying to use:

from sentence_transformers import SentenceTransformer model = SentenceTransformer("Muennighoff/SGPT-125M-weightedmean-nli-bitfit")

@Muennighoff
Copy link
Contributor Author

@Muennighoff @nreimers I still have the same issue, with Pytorch 1.12.2, cuda 10.2, and sentence-transformers 2.2.2. Im trying to use:

from sentence_transformers import SentenceTransformer model = SentenceTransformer("Muennighoff/SGPT-125M-weightedmean-nli-bitfit")

There has been no new version released since the merge, so you need to install from source via pip install --upgrade git+https://github.com/UKPLab/sentence-transformers.git. See also here for more information :)

@ReadyPlayerEmma
Copy link

ReadyPlayerEmma commented Apr 19, 2023

@nreimers Awesome work on this project. Would it be possible to make a release now that this is merged into the main branch now? It would be much appreciated to not have to install this from Git all the time. Perhaps there is some ongoing effort that has delayed a new release?

@redcodebluecode
Copy link

@nreimers I pip installed the newest version by using the commands shown below, and still having the same issue @Muennighoff mentioned earlier. I was trying code model = SentenceTransformer("Muennighoff/SGPT-125M-weightedmean-nli-bitfit") and I have an error message TypeError: __init__() got an unexpected keyword argument 'pooling_mode_weightedmean_tokens'. The pip commands I tried are listed below:

!pip install git+https://github.com/UKPLab/sentence-transformers.git
!pip install git+https://github.com/Muennighoff/sentence-transformers.git@sgpt_poolings_specb
!pip install --upgrade git+https://github.com/UKPLab/sentence-transformers.git
!pip install -U sentence-transformers

@Muennighoff
Copy link
Contributor Author

@nreimers I pip installed the newest version by using the commands shown below, and still having the same issue @Muennighoff mentioned earlier. I was trying code model = SentenceTransformer("Muennighoff/SGPT-125M-weightedmean-nli-bitfit") and I have an error message TypeError: __init__() got an unexpected keyword argument 'pooling_mode_weightedmean_tokens'. The pip commands I tried are listed below:

!pip install git+https://github.com/UKPLab/sentence-transformers.git
!pip install git+https://github.com/Muennighoff/sentence-transformers.git@sgpt_poolings_specb
!pip install --upgrade git+https://github.com/UKPLab/sentence-transformers.git
!pip install -U sentence-transformers

Hmm can you try what's explained here: Muennighoff/sgpt#14 (comment)

@maheshpec
Copy link

The code in pooling.py has been present in master branch since #1613 merged last September. Is there any help needed to release a version with the changes?

@np-n
Copy link

np-n commented Jan 24, 2024

@Muennighoff, I got stuck on same issue. I fixed it by running your solution.

!pip install git+https://github.com/UKPLab/sentence-transformers.git
!pip install git+https://github.com/Muennighoff/sentence-transformers.git@sgpt_poolings_specb
!pip install --upgrade git+https://github.com/UKPLab/sentence-transformers.git
!pip install -U sentence-transformers

Thank you!

@tomaarsen
Copy link
Collaborator

Hello!

I intend to publish a new release soon, then this should be fully resolved without the workaround. Until then, feel free to use the workaround! I'll close this, as SGPT support has been added.

  • Tom Aarsen

@zubairahmed-ai
Copy link

@tomaarsen still getting the error even after the latest update, any fix?

@tomaarsen
Copy link
Collaborator

Hello @zubairahmed-ai,

(Related: https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1/discussions/7)

I'm unable to reproduce this with the latest version. Are you confident that you're using the latest version? What happens if you run this code?

from sentence_transformers import SentenceTransformer, __version__ as sentence_transformers_version

print(sentence_transformers_version)
model = SentenceTransformer("mixedbread-ai/mxbai-embed-large-v1")
embeddings = model.encode(["The weather is nice", "It is sunny today"])
print(embeddings.shape)

A possibility is that your updated sentence transformers is installed in a different Python installation than what you use to run your LanceDB code.

  • Tom Aarsen

@zubairahmed-ai
Copy link

@tomaarsen

A possibility is that your updated sentence transformers is installed in a different Python installation than what you use to run your LanceDB code.

This was indeed the case, sorry for not updating, thanks for looking into it

@tomaarsen
Copy link
Collaborator

No worries! I'm glad you got it resolved :)

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

9 participants