gensim.models.Word2Vec(): unexpected keyword argument 'compute_loss'

2,201 views
Skip to first unread message

Thomas Fauskanger

unread,
Jul 21, 2017, 10:14:02 AM7/21/17
to gensim
Hello, everyone,

I followed and downloaded the tutorial notebook on Word2Vec from here: https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/word2vec.ipynb

In input[25], first cell after "Training Loss Computation" headline, I get an error in the Word2Vec class' initializer:

TypeError: __init__() got an unexpected keyword argument 'compute_loss'

I have gensim 2.2.0 installed via conda and have a new new clone from the gensim repository. I'm using 64-bit Python 3.5.3 on windows 10. (Anaconda)

According to the API reference, "compute loss" is a valid keyword: https://radimrehurek.com/gensim/models/word2vec.html.

I've tried to search for others with same encounter, but I haven't been successful. 

Do you know the reason for this behaviour?

Kind regards
~Thomas Fauskanger

Thomas Fauskanger

unread,
Jul 24, 2017, 5:35:52 AM7/24/17
to gensim
The Word2Vec class on GitHub does have the 'compute_loss' keyword, but my local library does not. I see that the gensim documentation and conda library deviate from each other. I found that the win-64/gensim-2.2.0-np113py35_0.tar.bz2-file in conda repository is not up to date.


What to do with this? Not use conda for gensim?


Kind regards
~Thomas

Thomas Fauskanger

unread,
Jul 24, 2017, 6:12:46 AM7/24/17
to gensim
After uninstalling gensim through conda, I reinstalled gensim with pip. However, it still doesn't work.

Apparently, the source on GitHub and the distributed library are different, but the tutorial seems to assume code is as on GitHub.

Ivan Menshikh

unread,
Jul 25, 2017, 2:42:33 AM7/25/17
to gensim
Hi Thomas,
Sorry for this, in documentation/notebooks we have a docstring from `develop` branch (not from `2.2.0`). This feature (compute_loss) will be available in next release.

Thomas Fauskanger

unread,
Jul 25, 2017, 6:17:47 AM7/25/17
to gensim
Thanks for the reply.

I should've used the `master` branch instead: I see that I was on the `develop` branch yes :)

Thanks again.

Thomas Fauskanger

unread,
Jul 31, 2017, 10:33:33 AM7/31/17
to gensim
In the new version, 2.3.0, 'compute_loss' is added in master. 

Thanks a lot! Keep up the good work.

~Thomas
Reply all
Reply to author
Forward
0 new messages