Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

total_vec don't exists #1746

Closed
set92 opened this issue Nov 30, 2017 · 12 comments
Closed

total_vec don't exists #1746

set92 opened this issue Nov 30, 2017 · 12 comments

Comments

@set92
Copy link

set92 commented Nov 30, 2017

I wanted to save the most important vectors or similar words, but I tried to cut the length of the embeddings using model.save_word2vec_format('try.c.w2v', total_vec=10000) but it says total_vec doesn't exists, but it's in the documentation.

@menshikh-iv
Copy link
Contributor

Hi @set92, please upgrade your gensim version pip install -U gensim, this feature comes from 2.1.0.
FYI - documentation always for latest version (right now - for 3.1.0)

@set92
Copy link
Author

set92 commented Nov 30, 2017

Im in 3.1.0, and before I was in 3.0.1 but I get the same error. I load a model using model = gensim.models.Word2Vec.load('../../models/model_w2v_medic_v2.bin') and then I try to save it with model.save_word2vec_format('try.c.w2v', total_vec=10000) and it gives the error TypeError: save_word2vec_format() got an unexpected keyword argument 'total_vec'

@menshikh-iv
Copy link
Contributor

@set92 you called this one (method of Word2Vec class), but add link to method of KeyedVectors class.
Please try model.wv.save_word2vec_format('try.c.w2v', total_vec=10000)

@set92
Copy link
Author

set92 commented Nov 30, 2017

Yes, you are right, I forgot about wv in model.wv.save_word2vec_format, thanks a lot.

@piskvorky
Copy link
Owner

piskvorky commented Nov 30, 2017

@menshikh-iv what's the difference between model.save_word2vec_format and model.wv.save_word2vec_format? That's some really strange API, we should fix that.

@menshikh-iv
Copy link
Contributor

menshikh-iv commented Nov 30, 2017

@piskvorky we should remove this deprecated methods for avoiding confusion, don't fix.

@piskvorky
Copy link
Owner

piskvorky commented Nov 30, 2017

Sure, but how can this even happen? How did they get out of sync?

I was under the impression the deprecated version is just an alias of the new one (until we remove it for good).

@menshikh-iv
Copy link
Contributor

@piskvorky

I was under the impression the deprecated version is just an alias of the new one (until we remove it for good).

From the beginning, that's exactly the way it was (i.e. full sync of interfaces), but later - #1256 this PR added total_vec param to KeyedVector.save_word2vec_format https://github.com/RaRe-Technologies/gensim/pull/1256/files#diff-741f69634ff2e1b2c4ce544e0d82a1e6R121 and doesn't update "deprecated" Word2Vec.save_word2vec_format

@piskvorky
Copy link
Owner

piskvorky commented Dec 1, 2017

Yeah, time to remove it.

Where do we keep the list of deprecated things + their schedule for removal (version)? Or do you just grep all source code before every release to find them?

@menshikh-iv
Copy link
Contributor

@piskvorky I have no idea, I assume that there is no such list (all these "deprecations" make before I came).

The first time, docstrings "forwarding" was added in #1251 (April 11), explicit deprecation added in #1274 (May 3), that looks like a fix for the previous PR.

@menshikh-iv
Copy link
Contributor

My plans are release minor (feature version) on next week and major (with change package structure, removing outdated stuff, etc) in next year (probably in January).

@piskvorky
Copy link
Owner

piskvorky commented Dec 2, 2017

Let's append a clear deprecation plan with each deprecation: in which version will the code be actually removed? (3.2.0 etc)

And then before each release, grep the code base for deprecations and actually remove the scheduled ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants