tffm
tffm copied to clipboard
Issue with tensorflow 2.0: module 'tensorflow_core._api.v2.train' has no attribute 'AdamOptimizer'
pip install tensorflow==2.0 import numpy as np import tensorflow as tf
from tffm import TFFMClassifier
gives error:
AttributeError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/tffm/init.py in
~/anaconda3/lib/python3.7/site-packages/tffm/models.py in
~/anaconda3/lib/python3.7/site-packages/tffm/base.py in
~/anaconda3/lib/python3.7/site-packages/tffm/core.py in
~/anaconda3/lib/python3.7/site-packages/tffm/core.py in TFFMCore() 94 """ 95 def init(self, order=2, rank=2, input_type='dense', loss_function=None, ---> 96 optimizer=tf.train.AdamOptimizer(learning_rate=0.01), reg=0, 97 init_std=0.01, use_diag=False, reweight_reg=False, 98 seed=None):
AttributeError: module 'tensorflow_core._api.v2.train' has no attribute 'AdamOptimizer'
FIX: Go to core.py file inside ttf folder. In the in the init function change optimizer to tf.keras.optimizers.Adam(....). Why? Read the following: https://stackoverflow.com/questions/55682718/module-tensorflow-api-v2-train-has-no-attribute-gradientdescentoptimizer
I ported this to tf2, check it out here: https://github.com/jamborta/tffm2