robbiebarrat / rapping-neural-network

Rap song writing recurrent neural network trained on Kanye West's entire discography
1.04k stars 167 forks source link

TypeError: Received unknown keyword arguments: {'epochs': 5} #18

Closed analyzehim closed 6 years ago

analyzehim commented 6 years ago

Hello! Thanks for you work, it's really nice (especcially a idea of generating kanye songs :) )

But i have a trouble, I'm trying to training model (by python model ), and after Alright, building the list of all the rhymes and show all bigram, get this:

_Traceback (most recent call last): File "model.py", line 300, in main(depth, trainmode) _File "model.py", line 290, in main train(x_data, ydata, model) File "model.py", line 273, in train verbose=1) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 661, in fit str(kwargs)) TypeError: Received unknown keyword arguments: {'epochs': 5}

My environment: Ubuntu 64bit, Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]

robbiebarrat commented 6 years ago

What version of keras are you using? run python, and then

import keras

keras.__version__

you may need to update keras...

analyzehim commented 6 years ago

My keras Version is 1.2.2. Should I use a 2.1.2 version?

robbiebarrat commented 6 years ago

before you update keras; try this:

on line 272; where it says

model.fit(np.array(x_data), np.array(y_data),
              batch_size=2,
              epochs=5,
              verbose=1)

change epochs=5, to nb_epoch=5, - i think that might work with your version

analyzehim commented 6 years ago

At first, I try you assumption (epochs -> nb_epochs), get the same error. After that, I updated keras to 2.1.2 (numpy to 1.13.3), and get this:

Using TensorFlow backend. Traceback (most recent call last): File "model.py", line 300, in main(depth, train_mode) File "model.py", line 277, in main model = create_network(depth) File "model.py", line 20, in create_network model.add(LSTM(4, input_shape=(2, 2), return_sequences=True)) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 464, in add layer(x) File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 482, in call return super(RNN, self).call(inputs, *kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 576, in call self.build(input_shapes[0]) File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 444, in build self.cell.build(step_input_shape) File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 1738, in build constraint=self.bias_constraint) File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper return func(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 397, in add_weight weight = K.variable(initializer(shape), File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 1730, in bias_initializer self.bias_initializer((self.units 2,), args, kwargs), File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1768, in concatenate return tf.concat([to_dense(x) for x in tensors], axis) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 692, in concat dtype=dtypes.int32).get_shape( File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 628, in convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 163, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 353, in make_tensor_proto _AssertCompatible(values, dtype) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 290, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

robbiebarrat commented 6 years ago

here - it works on my machine and these are my versions of everything

python 2.7 keras 2.0.8 tensorflow 1.4.1 numpy 1.13.0

I'm sorry that this isn't the most helpful response - but I don't know what else to try except for installing these versions of the packages and running the program then.

analyzehim commented 6 years ago

Hmmm... Thanks for the answer, anyway! Could you give me the CPU/GPU/RAM/HDD characteristic of your machie, please?

I run you neural network on very weak virtual machine, maybe this is the reason.

robbiebarrat commented 6 years ago

I developed / tested this on a super old thinkpad - right now it's running on my work computer which is pretty beefy (I work at NVIDIA right now) - so I've got 2 titans, an i7, and 64 gb of ram... hold up let me get an old commit you could run on your computer...

if you have tensorflow_gpu installed; I'd say uninstall that with pip uninstall tensorflow-gpu and then do pip install tensorflow so it will run on your CPU...

Virtual machine could be something to do with it, especially if you're trying to use tf gpu...

robbiebarrat commented 6 years ago

try to use the version here; before i did the keras rewrite i wrote it in pybrain, so you'll have to install all the stuff in requirements.txt with pip -r install requirements.txt (i think), but you could run this version on a toaster;

https://github.com/robbiebarrat/rapping-neural-network/tree/d1d341dd6f46263f790a3dc5c65a70d9a4eb0492

joejoe909 commented 1 year ago

it just nb_epoch=20 dont add the s at the end.