Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMF Model Cannot Be Imported Into Colab #22

Closed
gehcode opened this issue Jul 7, 2021 · 2 comments
Closed

NMF Model Cannot Be Imported Into Colab #22

gehcode opened this issue Jul 7, 2021 · 2 comments

Comments

@gehcode
Copy link

gehcode commented Jul 7, 2021

  • OCTIS version: 1.8.0

Description

Tried to import NMF model into Colab

What I Did

from octis.models.NMF import NMF
ImportError                               Traceback (most recent call last)
<ipython-input-17-96f0cef9c8fa> in <module>()
----> 1 from octis.models.NMF import NMF

/usr/local/lib/python3.7/dist-packages/octis/models/NMF.py in <module>()
      1 from octis.models.model import AbstractModel
      2 import numpy as np
----> 3 from gensim.models import nmf
      4 import gensim.corpora as corpora
      5 import octis.configuration.citations as citations

ImportError: cannot import name 'nmf' from 'gensim.models' (/usr/local/lib/python3.7/dist-packages/gensim/models/__init__.py)

@silviatti
Copy link
Collaborator

Hi!
I'll try to fix it as soon as possible. In the meantime, if you still want to use NMF, you can use the implementation that comes from scikit-learn: https://github.com/MIND-Lab/OCTIS/blob/master/octis/models/NMF_scikit.py

from octis.models.NMF_scikit import NMF_scikit
model = NMF_scikit(...)

@silviatti
Copy link
Collaborator

It seems that the version of gensim installed on colab was the 3.6.0 that hadn't implemented NMF yet. I set the version of gensim in the requirements to a higher version and now it works. So now you can use either NMF or NMF_scikit :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants