Open ooker777 opened 1 year ago
Correcting the code for v 3.4.1: pyLDAvis.gensim
-> pyLDAvis.gensim_models
import pickle
from gensim import models
#import pyLDAvis.gensim
import pyLDAvis.gensim_models as gensimvis
id2word = pickle.load(open('../data/id2word.pkl','rb'))
cv_vecs = pickle.load(open('../data/cv_vecs.pkl','rb'))
cv_corpus = pickle.load(open('../data/cv_corpus.pkl','rb'))
lda = models.LdaModel.load('../data/gensim_lda.model')
#viz = pyLDAvis.gensim.prepare(topic_model=lda, corpus=cv_corpus, dictionary=id2word, mds='mmds')
viz = gensimvis.prepare(topic_model=lda, corpus=cv_corpus, dictionary=id2word, mds='mmds')
Do you still get the same error?
FYI /data/cv_vecs.pkl
is not present in zip file (if needed)
I get an error trying to evaluate using your model
Traceback (most recent call last):
File "/Users/marksusol/DataScience/GitHub/pyLDAvis/issue253data/issue253.py", line 9, in <module>
lda = models.LdaModel.load('./data/gensim_lda.model')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/marksusol/DataScience/GitHub/pyLDAvis/venv/lib/python3.11/site-packages/gensim/models/ldamodel.py", line 1663, in load
result = super(LdaModel, cls).load(fname, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/marksusol/DataScience/GitHub/pyLDAvis/venv/lib/python3.11/site-packages/gensim/utils.py", line 487, in load
obj._load_specials(fname, mmap, compress, subname)
File "/Users/marksusol/DataScience/GitHub/pyLDAvis/venv/lib/python3.11/site-packages/gensim/utils.py", line 529, in _load_specials
val = np.load(subname(fname, attrib), mmap_mode=mmap)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/marksusol/DataScience/GitHub/pyLDAvis/venv/lib/python3.11/site-packages/numpy/lib/npyio.py", line 427, in load
fid = stack.enter_context(open(os_fspath(file), "rb"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './data/gensim_lda.model.expElogbeta.npy'
``
Can't reproduce, consider stale.
I get
I'm using pyLDAvis v3.4.1 on Python 3.10.10 on Windows. Here is the full code:
You can check the input files here