MartinoMensio / spacy-universal-sentence-encoder

Google USE (Universal Sentence Encoder) for spaCy
MIT License
176 stars 12 forks source link

Request for including a new USE model #15

Closed adaj closed 1 year ago

adaj commented 3 years ago

Hi, thanks for providing these USE-Spacy interfaces!! Recently Google released another USE, now as a conditional masked language model, please find it here https://tfhub.dev/google/universal-sentence-encoder-cmlm/multilingual-base/1.

My question is if that's possible for you to include it in this repo as well.

MartinoMensio commented 3 years ago

Hi @adaj, Thank you for opening the issue. I didn't know about the model that you linked. Version 0.4.3 adds support for these models. You can use the following CMLM models:

import spacy
# on top of any spacy model
nlp = spacy.load('en_core_web_md')
# add the pipeline stage with one of the values 
nlp.add_pipe('universal_sentence_encoder', config={'model_name': 'xx_use_cmlm'})

# this prints 0.9549750226856141
nlp('Hi there how are you').similarity(nlp('hello there how are you doing?'))

Let me know if you find any issues by using the models.

Best, Martino

adaj commented 3 years ago

Thanks a lot @MartinoMensio!