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

gensim版本问题 #1

Open
bigzhao opened this issue May 4, 2018 · 6 comments
Open

gensim版本问题 #1

bigzhao opened this issue May 4, 2018 · 6 comments

Comments

@bigzhao
Copy link

bigzhao commented May 4, 2018

你好,我想问一下你训练模型时gensim版本是多少?
我直接载入你已经训练好的模型会报错

@sunnypig
Copy link
Owner

sunnypig commented May 8, 2018

你好哦,之前使用的版没有记下来。请问有没有下载全部的模型文件并放到model文件夹下呢?可以把具体报错信息复制一下么?

@sunnypig
Copy link
Owner

sunnypig commented May 8, 2018

我之后更新一个requirements.txt文件吧

@bigzhao
Copy link
Author

bigzhao commented May 8, 2018

嗯我已经把所有文件都下载了
报错信息是:

`

AttributeError Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\gensim\models\doc2vec.py in load(cls, *args, **kwargs)
688 try:
--> 689 return super(Doc2Vec, cls).load(*args, **kwargs)
690 except AttributeError:

C:\Anaconda3\lib\site-packages\gensim\models\base_any2vec.py in load(cls, *args, **kwargs)
628 def load(cls, *args, **kwargs):
--> 629 model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
630 if model.negative and hasattr(model.wv, 'index2word'):

C:\Anaconda3\lib\site-packages\gensim\models\base_any2vec.py in load(cls, fname_or_handle, **kwargs)
277 def load(cls, fname_or_handle, **kwargs):
--> 278 return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
279

C:\Anaconda3\lib\site-packages\gensim\utils.py in load(cls, fname, mmap)
424
--> 425 obj = unpickle(fname)
426 obj._load_specials(fname, mmap, compress, subname)

C:\Anaconda3\lib\site-packages\gensim\utils.py in unpickle(fname)
1331 if sys.version_info > (3, 0):
-> 1332 return _pickle.load(f, encoding='latin1')
1333 else:

AttributeError: Can't get attribute 'DocvecsArray' on <module 'gensim.models.doc2vec' from 'C:\Anaconda3\lib\site-packages\gensim\models\doc2vec.py'>

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
in ()
----> 1 model = gensim.models.Doc2Vec.load('model/corpus.zhwiki.doc.model')

C:\Anaconda3\lib\site-packages\gensim\models\doc2vec.py in load(cls, *args, **kwargs)
691 logger.info('Model saved using code from earlier Gensim Version. Re-loading old model in a compatible way.')
692 from gensim.models.deprecated.doc2vec import load_old_doc2vec
--> 693 return load_old_doc2vec(*args, **kwargs)
694
695 def estimate_memory(self, vocab_size=None, report=None):

C:\Anaconda3\lib\site-packages\gensim\models\deprecated\doc2vec.py in load_old_doc2vec(*args, **kwargs)
144 new_model.train_count = old_model.train_count
145 new_model.corpus_count = old_model.corpus_count
--> 146 new_model.running_training_loss = old_model.running_training_loss
147 new_model.total_train_time = old_model.total_train_time
148 new_model.min_alpha_yet_reached = old_model.min_alpha_yet_reached

AttributeError: 'Doc2Vec' object has no attribute 'running_training_loss'
`

@sunnypig
Copy link
Owner

sunnypig commented May 8, 2018

piskvorky/gensim#1977
搜索了一下相关问题,发现是个gensim的bug
已经有人提交了修复,估计3.4.0后的版本就不会再报错拉
目前我就按照 issue 中某个回复的解决方案来处理 指定gensim版本为2.3.0, 写到了requirements.txt
因为模型数据太大 我没来得及重新下载测试,就麻烦你帮忙试一下啦

@sunnypig
Copy link
Owner

sunnypig commented May 8, 2018

不过你也可以选择下载一份wiki数据 从头训练,我的破机器那时候训练也就用了3-4个小时而已 :)

@bigzhao
Copy link
Author

bigzhao commented May 21, 2018

好的好的 感谢回复

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

2 participants