You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please help, When I load the Word2Vec model, I have a problem that I cannot solve.
The code to run is as follows:
from gensim.models import Word2Vec
w2v_model = Word2Vec.load('E:/projectlzy/data/word2vec_withString10-100-200.model')
FileNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 2>()
1 from gensim.models import Word2Vec
----> 2 w2v_model = Word2Vec.load('E:/projectlzy/data/word2vec_withString10-100-200.model')
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\word2vec.py:1141, in Word2Vec.load(cls, *args, **kwargs)
1122 """Load a previously saved :class:~gensim.models.word2vec.Word2Vec model.
1123
1124 See Also
(...)
1138
1139 """
1140 try:
-> 1141 model = super(Word2Vec, cls).load(*args, **kwargs)
1143 # for backward compatibility for max_final_vocab feature
1144 if not hasattr(model, 'max_final_vocab'):
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\base_any2vec.py:1230, in BaseWordEmbeddingsModel.load(cls, *args, **kwargs)
1199 @classmethod
1200 def load(cls, *args, **kwargs):
1201 """Load a previously saved object (using :meth:~gensim.models.base_any2vec.BaseWordEmbeddingsModel.save) from file.
1202
1203 Also initializes extra instance attributes in case the loaded model does not include them.
(...)
1228
1229 """
-> 1230 model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
1231 if not hasattr(model, 'ns_exponent'):
1232 model.ns_exponent = 0.75
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\base_any2vec.py:602, in BaseAny2VecModel.load(cls, fname_or_handle, **kwargs)
575 @classmethod
576 def load(cls, fname_or_handle, **kwargs):
577 """Load a previously saved object (using :meth:gensim.models.base_any2vec.BaseAny2VecModel.save) from a file.
578
579 Parameters
(...)
600
601 """
--> 602 return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
Please help, When I load the Word2Vec model, I have a problem that I cannot solve.
The code to run is as follows:
from gensim.models import Word2Vec
w2v_model = Word2Vec.load('E:/projectlzy/data/word2vec_withString10-100-200.model')
FileNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 2>()
1 from gensim.models import Word2Vec
----> 2 w2v_model = Word2Vec.load('E:/projectlzy/data/word2vec_withString10-100-200.model')
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\word2vec.py:1141, in Word2Vec.load(cls, *args, **kwargs)
1122 """Load a previously saved :class:
~gensim.models.word2vec.Word2Vec
model.1123
1124 See Also
(...)
1138
1139 """
1140 try:
-> 1141 model = super(Word2Vec, cls).load(*args, **kwargs)
1143 # for backward compatibility for
max_final_vocab
feature1144 if not hasattr(model, 'max_final_vocab'):
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\base_any2vec.py:1230, in BaseWordEmbeddingsModel.load(cls, *args, **kwargs)
1199 @classmethod
1200 def load(cls, *args, **kwargs):
1201 """Load a previously saved object (using :meth:
~gensim.models.base_any2vec.BaseWordEmbeddingsModel.save
) from file.1202
1203 Also initializes extra instance attributes in case the loaded model does not include them.
(...)
1228
1229 """
-> 1230 model = super(BaseWordEmbeddingsModel, cls).load(*args, **kwargs)
1231 if not hasattr(model, 'ns_exponent'):
1232 model.ns_exponent = 0.75
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\models\base_any2vec.py:602, in BaseAny2VecModel.load(cls, fname_or_handle, **kwargs)
575 @classmethod
576 def load(cls, fname_or_handle, **kwargs):
577 """Load a previously saved object (using :meth:
gensim.models.base_any2vec.BaseAny2VecModel.save
) from a file.578
579 Parameters
(...)
600
601 """
--> 602 return super(BaseAny2VecModel, cls).load(fname_or_handle, **kwargs)
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\utils.py:436, in SaveLoad.load(cls, fname, mmap)
433 compress, subname = SaveLoad._adapt_by_suffix(fname)
435 obj = unpickle(fname)
--> 436 obj._load_specials(fname, mmap, compress, subname)
437 logger.info("loaded %s", fname)
438 return obj
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\utils.py:467, in SaveLoad._load_specials(self, fname, mmap, compress, subname)
465 logger.info("loading %s recursively from %s.* with mmap=%s", attrib, cfname, mmap)
466 with ignore_deprecation_warning():
--> 467 getattr(self, attrib)._load_specials(cfname, mmap, compress, subname)
469 for attrib in getattr(self, '__numpys', []):
470 logger.info("loading %s from %s with mmap=%s", attrib, subname(fname, attrib), mmap)
File D:\Anaconda\envs\mykeras\lib\site-packages\gensim\utils.py:478, in SaveLoad._load_specials(self, fname, mmap, compress, subname)
476 val = np.load(subname(fname, attrib))['val']
477 else:
--> 478 val = np.load(subname(fname, attrib), mmap_mode=mmap)
480 with ignore_deprecation_warning():
481 setattr(self, attrib, val)
File D:\Anaconda\envs\mykeras\lib\site-packages\numpy\lib\npyio.py:390, in load(file, mmap_mode, allow_pickle, fix_imports, encoding)
388 own_fid = False
389 else:
--> 390 fid = stack.enter_context(open(os_fspath(file), "rb"))
391 own_fid = True
393 # Code to distinguish from NumPy binary files and pickles.
FileNotFoundError: [Errno 2] No such file or directory: 'E:/projectlzy/data/word2vec_withString10-100-200.model.wv.vectors.npy'
The text was updated successfully, but these errors were encountered: