2016-09-17 4 views

답변

3

단지

import gensim 

# Load pre-trained Word2Vec model. 
model = gensim.models.Word2Vec.load("modelName.model") 

로드

지금 당신이 평소와 같이 모델을 학습 할 수 있습니다. 또한 파일을 저장하고 여러 번 재수정하려는 경우 다음을 수행하십시오.

model.train(//insert proper parameters here//) 
""" 
If you don't plan to train the model any further, calling 
init_sims will make the model much more memory-efficient 
If `replace` is set, forget the original vectors and only keep the normalized 
ones = saves lots of memory! 
replace=True if you want to reuse the model 
""" 
model.init_sims(replace=True) 

# save the model for later use 
# for loading, call Word2Vec.load() 

model.save("modelName.model") 
+0

파일 "C : \ ... \ Python \ Python35 \ lib \ site- 패키지 \ gensim \ utils.py ", 줄 911, unpickle 반환 _pickle.loads (f.read()) _pickle.UnpicklingError : 잘못된로드 키 '6'. – Vahid

+0

'_pickle.UnpicklingError : 잘못된로드 키 '3'. '.load_word2vec_format()'이 도움이 될 수있는 경우가 있습니다. – mrgloom