oborchers / Fast_Sentence_Embeddings

Compute Sentence Embeddings Fast!
GNU General Public License v3.0
616 stars 83 forks source link

error with fse.average function #72

Open antoniakrm opened 1 year ago

antoniakrm commented 1 year ago

TypeError                                 Traceback (most recent call last)
[<ipython-input-16-9b53162cbd8a>](https://localhost:8080/#) in <module>
      2 
      3 vecs = Vectors.from_pretrained("glove-wiki-gigaword-50")
----> 4 model = Average(vecs)
      5 
      6 sentences = [["cat", "say", "meow"], ["dog", "say", "woof"]]

1 frames
[/usr/local/lib/python3.7/dist-packages/fse/models/base_s2v.py](https://localhost:8080/#) in __init__(self, model, sv_mapfile_path, wv_mapfile_path, workers, lang_freq, fast_version, batch_words, batch_ngrams, **kwargs)
    159         self.prep = BaseSentence2VecPreparer()
    160 
--> 161         self.word_weights = ones(len(self.wv), REAL)
    162 
    163     def __str__(self) -> str:

TypeError: object of type 'Word2VecKeyedVectors' has no len()