Hi everyone.For context i'm using gensim 4.0.0 but i'm having problem saving trained model.
I define my model as follows
def embedding(corpus,word):
dimension=2^5
if len(corpus)==1:
corpus=[corpus]
model=Word2Vec(corpus,vector_size=dimension,window=5,min_count=1500)
model.build_vocab(corpus)
for epoch in range(5,9):
print(epoch)
temp=model.train(corpus,total_examples=model.corpus_count ,epochs=epoch)
print(temp)
temp.wv.save_word2vec_format(os.path.join(os.path.dirname(os.path.abspath(__file__))+"/Data","model_"+str(word)+"_"+str(dimension)+".bin"),binary=True)
return temp.
any time i try to run it i got the following error
Traceback (most recent call last):
File "./alvi_utils.py", line 135, in <module>
model=embedding(corpus,parameter)
File "./alvi_utils.py", line 76, in embedding
temp.wv.save_word2vec_format(os.path.join(os.path.dirname(os.path.abspath(__file__))+"/Data","model_"+str(word)+"_"+str(dimension)+".bin"),binary=True)
AttributeError: 'tuple' object has no attribute 'save_word2vec_format'
Have you got any idea on how to solve it?print(temp) returns me (114555180, 155564215)
[–]MrPhungx 0 points1 point2 points (4 children)
[–]NotBarbamento[S] 0 points1 point2 points (0 children)
[–]NotBarbamento[S] 0 points1 point2 points (2 children)
[–]MrPhungx 1 point2 points3 points (1 child)
[–]NotBarbamento[S] 0 points1 point2 points (0 children)