MartinoMensio / spacy-sentence-bert

Sentence transformers models for SpaCy
MIT License
104 stars 7 forks source link

BERT transformers - trial on google colab #3

Open yomnamahmoud opened 3 years ago

yomnamahmoud commented 3 years ago

I was running the following example as part of multiple trials on google collab:

import spacy_sentence_bert

nlp = spacy_sentence_bert.load_model('en_roberta_large_nli_stsb_mean_tokens') doc_1 = nlp('Hi there, how are you?') doc_2 = nlp('Hello there, how are you doing today?') print(doc_1.similarity(doc_2[0:7]))

I got the following message :

 24 
 25 # the pipeline stage factory

---> 26 @Language.factory('sentence_bert', default_config={ 27 'model_name': None, 28 'debug': True

AttributeError: type object 'Language' has no attribute 'factory'

I am currently trying to trace it in the library itself but any suggestion would be appreciated,

MartinoMensio commented 1 year ago

hi @yomnamahmoud , Can you please check the version of SpaCy? You may be running a version not up to date. I think Language.factory was introduced with SpaCy v2 or higher. Now I would recommend at least spaCy v3.

Best, Martino