llSourcell/Music_Generator_Demo

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

Opened this issue · 2 comments

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 gibbs_sample
[_, _, 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

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 ?

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.