Issue
I'm getting this error when trying to run Ann Visualizer from Anaconda/Jupyter. I have read several threads on this site and others and can't seem to make the error go away:
ImportError Traceback (most recent call last)
<ipython-input-54-bdba1202aeda> in <module>
1 from ann_visualizer.visualize import ann_viz
2
----> 3 ann_viz(model, title="VOC Neural Network")
~\Anaconda3\lib\site-packages\ann_visualizer\visualize.py in ann_viz(model, view, filename, title)
29 """
30 from graphviz import Digraph;
---> 31 import keras;
32 from keras.models import Sequential;
33 from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten;
~\AppData\Roaming\Python\Python37\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\AppData\Roaming\Python\Python37\site-packages\keras\models.py in <module>
17
18 import tensorflow.compat.v2 as tf
---> 19 from keras import backend
20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
~\AppData\Roaming\Python\Python37\site-packages\keras\backend.py in <module>
35 from tensorflow.python.distribute import distribute_coordinator as dc
36 from tensorflow.python.distribute import distribute_coordinator_context as dc_context
---> 37 from tensorflow.python.eager.context import get_config
38 from tensorflow.python.framework import config
39 from keras import backend_config
ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context'
My Tensorflow/Keras versions are 2.4.0 when I run
print("Tensorflow : " + tf.__version__)
print("Keras : " + keras.__version__)
But in the Anaconsa environment it says 2.3.0 - Not sure if that's a factor?
I'm aware the ANN Visualizer only runs with Tensorflow > 2.1
I updated all my library calls to from tensorflow import keras
(for example)
I'm not really sure what to do next - does anyone have any ideas?
Many thanks in advance for any help you can give..
Solution
from tensorflow.python.eager.context import get_config
Works fine with Tensorflow 2.5.
Install Tensorflow 2.5
!pip install tensorflow==2.5
Answered By - TFer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.