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

Not able to run NeuroNER model with python 3.8 and Tensorflow 2+ #175

Open
ansjain83 opened this issue May 18, 2021 · 2 comments
Open

Not able to run NeuroNER model with python 3.8 and Tensorflow 2+ #175

ansjain83 opened this issue May 18, 2021 · 2 comments

Comments

@ansjain83
Copy link

Would like to use python 3.8 and Tensorflow 2+ for neuroner model. Is it supported?

@tyi1025
Copy link

tyi1025 commented May 18, 2021

I would like to know too.

@gitclem
Copy link

gitclem commented Sep 7, 2021

Would like to use python 3.8 and Tensorflow 2+ for neuroner model. Is it supported?

I found out with Python 3.8.10 and TF 2.5.0
I get the error:

from neuroner import neuromodel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/clem/penv/dsexp/lib/python3.8/site-packages/neuroner/neuromodel.py", line 20, in <module>
    from tensorflow.contrib.tensorboard.plugins import projector
ModuleNotFoundError: No module named 'tensorflow.contrib'
>>> 

This is because (damned) TF programmers are cavalier about backwards compatibility... The entire module tf.contrib has disappeared...

However, the fix is easy. In the file neuromodel.py

replace

from tensorflow.contrib.tensorboard.plugins import projector

with

try:
    from tensorflow.contrib.tensorboard.plugins import projector  # for TF 1.0
except ModuleNotFoundError:
    from tensorboard.plugins import projector  # for TF 2.0

[added]
It turns out there are a number of incompatibilities between TF 1.x and TF 2.x and it's a bit of work to find and fix them all...

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

3 participants