dsfsi/textaugment

AttributeError: 'FastTextKeyedVectors' object has no attribute 'wv' suppose due to Migration from Gensin 3.x to 4

daniel-satria opened this issue · 5 comments

Hello thank you for making this module!
It's so helpful.

I have problem to use it for Indonesian language using FastText.
I downloded the model for Indonesia and follow this example notebook as instructed, but get error as follow when I tried to execute this below code.

  • Code :
    t = Word2vec(model = model.wv) output = t.augment('Ceritanya bagus')

  • Error :

AttributeError: 'FastTextKeyedVectors' object has no attribute 'wv'

After I did some research it says that there's changes due to Migrating from Gensim 3.x to 4.
The change log have been documented here.

Then, I tried to changed my code as below and get different error :

  • Code 2:
    t = Word2vec(model = model.wv.most_similar) output = t.augment('Ceritanya bagus. Aku suka sekali')

  • Error 2 :

TypeError: Model path must be a string. Or type of model must be a gensim.models.word2vec.Word2Vec or gensim.models.keyedvectors.Word2VecKeyedVectors or gensim.models.keyedvectors.FastTextKeyedVectors type. To load a model use gensim.models.Word2Vec.load('path')

Could someone please tell me how could I fix the error?
It seems there are some changes to do augmentation since Gensim migrated to version 4.

Thank you!

Hi, can you downgrade your gensim to v3.x and test your code.

Hello Joseph,
Thank you for responding my question.

I've tried to downgrade my gensim to v3.8 and v3.8.3 but whenever I try to import gensim this below error occurs.

ImportError: cannot import name 'Mapping' from 'collections' (c:\Users\xxx\Anaconda3\envs\nlp\lib\collections_init_.py)

I wonder in which version of gensim this module could work?
Thank you in advance!

Create a new environment where you have python==3.6 and gensim==3.3.0

@JosephSefara We might have to put in some time to take care of this by closing #18

@daniel-satria might you be interested in submitting a pull request?

@daniel-satria check release 2.0

thank you @JosephSefara