llSourcell / Music_Generator_Demo

Music Generator Demo by @Sirajology on Youtube
247 stars 124 forks source link

AttributeError: module 'tensorflow' has no attribute 'placeholder' #27

Open mdwhitis opened 4 years ago

mdwhitis commented 4 years ago

You will get this error if using TensorFlow 2.x:

Traceback (most recent call last): File "C:\Users\y\AppData\Local\Programs\Python\Python37\music-generator-1\rbm_chords.py", line 59, in x = tf.placeholder(tf.float32, [None, n_visible], name="x") AttributeError: module 'tensorflow' has no attribute 'placeholder'

I fixed it by changing: rbm_chords.py:

import tensorflow as tf

import tensorflow.compat.v1 as tf tf.disable_v2_behavior()