I am trying to keep track of this laptop, the problem is that it is written for Py 2.7, and I am trying to port it to Py 3.6. Fortunately, someone ported the MIDI library to Py 3 https://github.com/louisabraham/python3-midi , and I was able to use this to parse midi files into a numpy array, Now my problem is that I get these errors.
https://github.com/bhaktipriya/Blues/blob/master/Music.ipynb
TypeError Traceback (most recent call last)
<ipython-input-62-f35c20bfe55b> in <module>()
1
3 print(x_sample)
4
5 h=sample(tf.sigmoid(tf.matmul(x, W) + bh))
<ipython-input-57-943cbc813622> in gibbs_sample(k)
13
14 ct=tf.constant(0)
16
17 x_sample=tf.stop_gradient(x_sample)
c:\users\ali\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py in while_loop(cond, body, loop_vars, shape_invariants, parallel_iterations, back_prop, swap_memory, name, maximum_iterations)
3051 raise TypeError("body must be callable.")
3052 if parallel_iterations < 1:
-> 3053 raise TypeError("parallel_iterations must be a positive integer.")
3054
3055 if maximum_iterations is not None:
TypeError: parallel_iterations must be a positive integer.
I also get weird errors with the numpy array form in the training phase
size_tr=tf.cast(tf.shape(x)[0], tf.float32)
eta=lr/size_tr
W_upd=tf.multiply(eta, tf.subtract(tf.matmul(tf.transpose(x), h), tf.matmul(tf.transpose(x_sample), h_sample)))
bv_upd=tf.multiply(eta, tf.reduce_sum(tf.subtract(x, x_sample), 0, True))
bh_upd=tf.multiply(eta, tf.reduce_sum(tf.subtract(h, h_sample), 0, True))
updt=[W.assign_add(W_upd), bv.assign_add(bv_upd), bh.assign_add(bh_upd)]
sess=tf.Session()
init=tf.initialize_all_variables()
sess.run(init)
for epoch in tqdm(range(epochs)):
for song in songs:
song=np.array(song)
chunks=song.shape[0]/timesteps
chunks = int(np.floor(chunks))
dur=chunks*timesteps
dur = int(np.floor(dur))
song=song[:dur]
song=np.reshape(song, [chunks, song.shape[1]*timesteps])
for i in range(1, len(song), batch_size):
tr_x=song[i:i+batch_size]
sess.run(updt, feed_dict={x: tr_x})
Error is:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_7' with dtype float and shape [?,2340]
[[Node: x_7 = Placeholder[dtype=DT_FLOAT, shape=[?,2340], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]