conx icon indicating copy to clipboard operation
conx copied to clipboard

Keras Optimizer TFOptimizer

Open noobmaster29 opened this issue 4 years ago • 3 comments

Hello,

I just installed conx and my tensorflow version is 2.4.0.

When I try to import conx with import conx as cx, I get the follow error message.


ImportError Traceback (most recent call last) in () ----> 1 import conx as cx

2 frames /usr/local/lib/python3.6/dist-packages/conx/layers.py in () 41 import keras 42 import keras.backend as K ---> 43 from keras.optimizers import (SGD, RMSprop, Adagrad, Adadelta, Adam, Adamax, Nadam, 44 TFOptimizer) 45

ImportError: cannot import name 'TFOptimizer'


Is there anyway to fix this?

noobmaster29 avatar Dec 24 '20 23:12 noobmaster29

Conx was written for tf 1. So, you could down-grade tf. But we're also going to redo conx in the next few weeks to work with a more modern tf.

dsblank avatar Dec 25 '20 00:12 dsblank

Thank you very much for your help.

I was trying to run the code in this notebook: https://nbviewer.jupyter.org/github/Calysto/conx-notebooks/blob/master/work-in-progress/AlphaZero.ipynb

I was initially running tensorflow 1 but then "from keras import regularizers" throws up an error to install tensorflow 2 version.

I look forward to conx that works with tensorflow 2. In the meantime, I'll see if regularizers can be replaced with something else.

Happy Holidays.

noobmaster29 avatar Dec 25 '20 00:12 noobmaster29

The full error when I try to import conx without tensorflow version 2 is:


ModuleNotFoundError Traceback (most recent call last) /anaconda3/envs/rl/lib/python3.7/site-packages/keras/init.py in 2 try: ----> 3 from tensorflow.keras.layers.experimental.preprocessing import RandomRotation 4 except ImportError:

ModuleNotFoundError: No module named 'tensorflow'

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) in ----> 1 from conx import Network

/anaconda3/envs/rl/lib/python3.7/site-packages/conx/init.py in 42 matplotlib.use('Agg') # something that will work 43 from ._version import version, VERSION ---> 44 from .network import * 45 from .layers import * 46 from .dataset import *

/anaconda3/envs/rl/lib/python3.7/site-packages/conx/network.py in 44 import numpy as np 45 import matplotlib.pyplot as plt ---> 46 import keras 47 from keras.callbacks import Callback, History 48 import keras.backend as K

/anaconda3/envs/rl/lib/python3.7/site-packages/keras/init.py in 4 except ImportError: 5 raise ImportError( ----> 6 'Keras requires TensorFlow 2.2 or higher. ' 7 'Install TensorFlow via pip install tensorflow') 8

ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

noobmaster29 avatar Dec 25 '20 00:12 noobmaster29