'fichier' objet n'a pas d'attribut "rfind'
Je suis en train d'enregistrer un word2vec à un fichier.
model = Word2Vec(sentences, size=vector_size, window=5, min_count=5, workers=4)
fo = open("foo.txt", "wb")
model.save(fo)
J'obtiens l'erreur suivante dans genericpath.py
File "word2Vec_impl.py", line 39, in <module>
model.save(fo, separately=None)
File "C:\Python27\lib\site-packages\gensim\models\word2vec.py", line 669, in s
ave
super(Word2Vec, self).save(*args, **kwargs)
File "C:\Python27\lib\site-packages\gensim\utils.py", line 269, in save
pickle(self, fname)
File "C:\Python27\lib\site-packages\gensim\utils.py", line 608, in pickle
with smart_open(fname, 'wb') as fout: # 'b' for binary, needed on Windows
File "C:\Python27\lib\site-packages\gensim\utils.py", line 596, in smart_open
_, ext = path.splitext(fname)
File "C:\Python27\lib\ntpath.py", line 190, in splitext
return genericpath._splitext(p, sep, altsep, extsep)
File "C:\Python27\lib\genericpath.py", line 91, in _splitext
sepIndex = p.rfind(sep)
AttributeError: 'file' object has no attribute 'rfind'
Où je vais mal?
OriginalL'auteur user3228815 | 2014-05-24
Vous devez vous connecter pour publier un commentaire.
Word2Vec.save
accepte un nom de fichier, pas un objet de fichier.OriginalL'auteur falsetru