llSourcell / Music_Generator_Demo

Music Generator Demo by @Sirajology on Youtube
246 stars 123 forks source link

AttributeError: 'module' object has no attribute 'While' #6

Open cgayner opened 7 years ago

cgayner commented 7 years ago

Hi there, I am getting this issue when I run the program: RESTART: …/Music_Generator_Demo-master/Pop_Music_Midi/rbm_chords_clone.py

0it [00:00, ?it/s] 0 songs processed

Traceback (most recent call last): File "…/Music_Generator_Demo-master/Pop_Music_Midi/rbm_chords_clone.py", line 87, in x_sample = gibbs_sample(1) File "…/Music_Generator_Demo-master/Pop_Music_Midi/rbm_chords_clone.py", line 77, in gibbssample [, _, x_sample] = control_flow_ops.While(lambda count, num_iter, *args: count < num_iter, AttributeError: 'module' object has no attribute 'While'

Initially I ran the program as it was but got this error …/Music_Generator_Demo-master/Pop_Music_Midi/midi_manipulation.py", line 1, in import midi ImportError: No module named midi

I updated the file to read midi_manipulation and it seemed to fix it.

Thought I would mention in case this was wrong.

Welcome thoughts on how to resolve. Cheers

hiepph commented 7 years ago

Hi, about Midi problem, try to pull this project https://github.com/florianfesti/python-midi (a fork from python-midi with python3 support), and install with python3 setup.py install

I stuck at this error, too:

AttributeError: module 'tensorflow.python.ops.control_flow_ops' has no attribute 'While'

Maybe tensorflow 1.0 has changed API ?

JacobyJoukema commented 7 years ago

I think I found a solution to this issue. With TensorFlow1.0 control_flow_ops has effectively been replaced. It is possible to achieve the same functionality by replacing the control_flow_ops.While function with the tf.While function. I achieved this by using the following code:

ct = tf.constant(0) cond = lambda count, k, x: tf.less(count,k) [_,_, xSample] = tf.while_loop(cond, gibbs_step, [ct, tf.constant(k), self.x])

Let me know if this works for you.