Skip to content

Commit 53f246d

Browse files
committed
partly fixed rnnrbm, but we will need to do some magic with the midi module to make it compatible with python 3
1 parent 2c022d1 commit 53f246d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

code/rnnrbm.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# RNN-RBM deep learning tutorial
44
# More information at http://deeplearning.net/tutorial/rnnrbm.html
55

6+
from __future__ import print_function
7+
from six.moves import xrange
8+
69
import glob
710
import os
811
import sys
@@ -11,10 +14,8 @@
1114
try:
1215
import pylab
1316
except ImportError:
14-
print (
15-
"pylab isn't available. If you use its functionality, it will crash."
16-
)
17-
print "It can be installed with 'pip install -q Pillow'"
17+
print ("pylab isn't available. If you use its functionality, it will crash.")
18+
print("It can be installed with 'pip install -q Pillow'")
1819

1920
from midi.utils import midiread, midiwrite
2021
import theano
@@ -257,12 +258,12 @@ def train(self, files, batch_size=100, num_epochs=200):
257258
cost = self.train_function(sequence[i:i + batch_size])
258259
costs.append(cost)
259260

260-
print 'Epoch %i/%i' % (epoch + 1, num_epochs),
261-
print numpy.mean(costs)
261+
print('Epoch %i/%i' % (epoch + 1, num_epochs))
262+
print(numpy.mean(costs))
262263
sys.stdout.flush()
263264

264265
except KeyboardInterrupt:
265-
print 'Interrupted by user.'
266+
print('Interrupted by user.')
266267

267268
def generate(self, filename, show=True):
268269
'''Generate a sample sequence, plot the resulting piano-roll and save

0 commit comments

Comments
 (0)