Fast_Sentence_Embeddings icon indicating copy to clipboard operation
Fast_Sentence_Embeddings copied to clipboard

error with fse.average function

Open antoniakrm opened this issue 2 years ago • 0 comments


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()

antoniakrm avatar Nov 23 '22 17:11 antoniakrm