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

Model not loading #106

Open
laylabitar opened this issue Jan 29, 2024 · 7 comments
Open

Model not loading #106

laylabitar opened this issue Jan 29, 2024 · 7 comments

Comments

@laylabitar
Copy link

Hello,

I had a previous project where I was running a function with the instructor similarity to calculate the semantic similarity,

I come back to this project finding that I am unable to load the model with an error that I hadn't come across before:


TypeError Traceback (most recent call last)
in <cell line: 2>()
1 from InstructorEmbedding import INSTRUCTOR
----> 2 model = INSTRUCTOR('hkunlp/instructor-base')

/usr/local/lib/python3.10/dist-packages/sentence_transformers/SentenceTransformer.py in init(self, model_name_or_path, modules, device, cache_folder, trust_remote_code, revision, token, use_auth_token)
192
193 if is_sentence_transformer_model(model_name_or_path, token, cache_folder=cache_folder, revision=revision):
--> 194 modules = self._load_sbert_model(
195 model_name_or_path,
196 token=token,

TypeError: INSTRUCTOR._load_sbert_model() got an unexpected keyword argument 'token'

I would appreciate the assistance on this issue!

@laylabitar
Copy link
Author

Ah solved it, it was a simple dependency issue with the sentence transformers ( they updated a new version 9 hours ago) so just make sure to pip install sentence_transformers==2.2.2

@racinmat
Copy link
Contributor

Same, supporting newer transformers would be great, because e.g. nomic needs at least transformers 2.3 because of the trust_remote_code.

@rachithaiyappa
Copy link

+1
Also, the resulting instruction embeddings using sentence-transformers=3.0.1 is different from using sentence-transformers=2.2.2 which makes sense but leaving it here for completeness.

@BBC-Esq
Copy link
Contributor

BBC-Esq commented Aug 12, 2024

The owners of this repository don't really update anymore, but you can try my fork here instead, which is compatible with the newest version of sentence-transformers:

https://github.com/BBC-Esq/instructor-embedding

@racinmat
Copy link
Contributor

Or you can use my fork from #115 , which contains few more additions https://github.com/racinmat/instructor-embedding/tree/main

@BBC-Esq
Copy link
Contributor

BBC-Esq commented Aug 24, 2024

A fork of my fork! lol I like it. What else did you add?

@racinmat
Copy link
Contributor

I reverted some renamings, so the class names are compatible with the version of instructor released on pypi and I added support for offline loading, so if the weights are present locally, it does not have to reach to the internet.

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

4 participants