I have the following architecture: Given two sequences (first and second) I am trying to predict a sequence of floats (labels) inside the multiple LSTM-based model. The way I have implemented the model is similar to the sequence to sequence model in Tutorial 204. The code calling the model is as under:
firstAxis = Axis.new_unique_dynamic_axis('firstAxis')
secondAxis = Axis.new_unique_dynamic_axis('secondAxis')
labelAxis = Axis.new_unique_dynamic_axis('labelAxis')
FirstSequence = C.sequence.input_variable(len(word_to_idx), sequence_axis=firstAxis, name="first")
SecondSequence = C.sequence.input_variable(len(word_to_idx), sequence_axis=secondAxis, name="second")
LabelSequence = C.sequence.input_variable(1, sequence_axis=labelAxis, name="label")
def create_model_train(s2smodel):
@C.Function
def model_train(first: FirstSequence,
second: SecondSequence,
labels: LabelSequence): # The error is on this line
past_labels = C.layers.Delay(initial_state=sentence_start)(labels)
return s2smodel(past_labels, first, second)
return model_train
However, in the function model_train I get this error:
Traceback (most recent call last):
File "cntktrain-lstm.py", line 230, in <module>
logs = train(model, data, args, logs, data['train'].word_to_idx, 1)
File "cntktrain-lstm.py", line 187, in train
model_train = create_model_train(s2smodel)
File "cntktrain-lstm.py", line 150, in create_model_train
labels: LabelSequence):
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/ops/functions.py", line 109, in __new__
return Function._to_Function(*args, **kwargs)
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/ops/functions.py", line 163, in _to_Function
args = [make_arg_variable(arg_name, annotations) for arg_name in arg_names]
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/ops/functions.py", line 163, in <listcomp>
args = [make_arg_variable(arg_name, annotations) for arg_name in arg_names]
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/ops/functions.py", line 139, in make_arg_variable
var_type = Variable._Type._sanitize(var_type)
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/variables.py", line 260, in _sanitize
if the_type == float:
File "/root/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/cntk_py.py", line 3761, in <lambda>
Variable.__eq__ = lambda a,b: (a is not None and b is not None and Variable_eq(a,b)) or (a is None and b is None)
TypeError: in method 'Variable_eq', argument 2 of type 'CNTK::Variable const &'
I couldn't find anything online for this error. Can someone please guide me?
Hi
I have the following architecture: Given two sequences (first and second) I am trying to predict a sequence of floats (labels) inside the multiple LSTM-based model. The way I have implemented the model is similar to the sequence to sequence model in Tutorial 204. The code calling the model is as under:
However, in the function model_train I get this error:
I couldn't find anything online for this error. Can someone please guide me?