AI_Composer
AI_Composer copied to clipboard
Fixing: 'This module is deprecated'
Hello Siraj,
I fixed the model.py for the 0.10.0 version of tensorflow.
@Atles The rnn_cell, rnn, etc. can now be imported correctly with your fix, but I'm getting an error in the code about the zero_state
. It seems to have returned a tuple instead of a tensor. Do you have any idea of how to fix that? Thanks.
Traceback (most recent call last):
File "main.py", line 17, in <module>
rnn.train_model()
File "/Users/xslittlegrass/Downloads/AI_Composer/rnn.py", line 142, in train_model
data["train"]["data"], training=True, testing=False)
File "/Users/xslittlegrass/Downloads/AI_Composer/util.py", line 190, in run_epoch
state = model.get_cell_zero_state(session, batch_size)
File "/Users/xslittlegrass/Downloads/AI_Composer/model.py", line 98, in get_cell_zero_state
return self.cell.zero_state(batch_size, tf.float32).eval(session=session)
AttributeError: 'tuple' object has no attribute 'eval'
Hi @xslittlegrass, I have submit the first version with an error.
I have put this in the code:
cell = cell_class(hidden_size, num_units=input_size)
But must be this:
cell = cell_class(hidden_size, input_size = input_size)
Check if this is the problem.
@Atles I pulled directly from your repo at https://github.com/Atles/AI_Composer. In that repo, the line you mentioned is
cell = cell_class(hidden_size)
If I add the input_size=input_size
, the error about zero_state
still exists. And I get another warning about the second parameter to BasicLSTMCell
:
WARNING:tensorflow:<tensorflow.python.ops.rnn_cell.BasicLSTMCell object at 0x12d543710>: The input_size parameter is deprecated.
@xslittlegrass Sorry, the correct one is:
cell = cell_class(hidden_size)
I don't know how to solve your problem =/
The problem is in this function:
def get_cell_zero_state(self, session, batch_size):
return self.cell.zero_state(batch_size, tf.float32).eval(session=session)
but, self.cell.zero_state(batch_size, tf.float32)
should not be a tuple.
I try to run here and i didn't get this problem...
@Atles That's strange. What version of tensorflow are you using?
@xslittlegrass I'm using tensorflow 0.10.0.
@Atles That's strange. I'm using version 0.11 and get the error. I'm seeing that self.cell.zero_state(batch_size, tf.float32)
returns a tuple
(
LSTMStateTuple(c=<tf.Tensor 'zeros:0' shape=(85, 200) dtype=float32>, h=<tf.Tensor 'zeros_1:0' shape=(85, 200) dtype=float32>),
LSTMStateTuple(c=<tf.Tensor 'zeros_2:0' shape=(85, 200) dtype=float32>, h=<tf.Tensor 'zeros_3:0' shape=(85, 200) dtype=float32>)
)
Do you have any ideas?
@xslittlegrass well, i don't know if this is releted with the problem, but using my version of tensor flow, I get a warning.
WARNING:tensorflow:<tensorflow.python.ops.rnn_cell.BasicLSTMCell object at 0x7f69b385b0d0>: Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True.
Maybe in your version of tensorflow this become a problem.
@Atles hello , i have another problem
Traceback (most recent call last): File "main.py", line 17, in <module> rnn.train_model() File "/home/derek/AI_Composer/rnn.py", line 129, in train_model train_model = model_class(config, training=True) File "/home/derek/AI_Composer/model.py", line 64, in __init__ self.cell = tf.nn.rnn_cell.MultiRNNCell( AttributeError: 'module' object has no attribute 'rnn_cell'
do you know how to fix these , and thx for this fix
my tensorflow is 1.0.1
@DerekQQQ What version of tensorflow are you using?
@Atles after i change tensorflow to r10 it is all fixed but i used 3.5 hr to train the model , is it right?!
THX