Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __call__() got an unexpected keyword argument 'previous_alignments' issue #8

Open
KhinePisi opened this issue Mar 16, 2020 · 0 comments

Comments

@KhinePisi
Copy link

I run the evaluation code for NQA commonsense on GoogleColab like this ,
!python CommonSenseMultiHopQA/src/config.py
--mode test
--version commonsense_nqa
--model_name CommonSenseMultiHopQA/out/NQACommonsense
--use_ckpt "epoch_0009_step00012500_bleu1(0.461571)_bleu4(0.217204)_meteor(0.210980)_rogue(0.495554).data-00000-of-00001"
--processed_dataset_train CommonSenseMultiHopQA/data/narrative_qa_train.jsonl
--processed_dataset_valid CommonSenseMultiHopQA/data/narrative_qa_valid.jsonl
--processed_dataset_test CommonSenseMultiHopQA/data/narrative_qa_test.jsonl
--batch_size 24
--max_target_iterations 15
--dropout_rate 0.2

and I got the error like this >>>
WARNING: Logging before flag parsing goes to stderr.
W0316 13:24:01.048576 140715097528192 module_wrapper.py:139] From CommonSenseMultiHopQA/src/config.py:96: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

['CommonSenseMultiHopQA/src/config.py', '--mode', 'test', '--version', 'commonsense_nqa', '--model_name', 'CommonSenseMultiHopQA/out/NQACommonsense', '--use_ckpt', 'epoch_0009_step00012500_bleu1(0.461571)_bleu4(0.217204)_meteor(0.210980)_rogue(0.495554).data-00000-of-00001', '--processed_dataset_train', 'CommonSenseMultiHopQA/data/narrative_qa_train.jsonl', '--processed_dataset_valid', 'CommonSenseMultiHopQA/data/narrative_qa_valid.jsonl', '--processed_dataset_test', 'CommonSenseMultiHopQA/data/narrative_qa_test.jsonl', '--batch_size', '24', '--max_target_iterations', '15', '--dropout_rate', '0.2']
Evaluating!
W0316 13:24:01.678194 140715097528192 lazy_loader.py:50]
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

W0316 13:24:01.678544 140715097528192 deprecation.py:506] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/initializers.py:94: calling init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
Vocab built! Size (35965)
Data loaded!
W0316 13:24:05.527146 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/model_commonsense_nqa.py:36: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

W0316 13:24:05.541138 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/model_commonsense_nqa.py:40: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0316 13:24:05.602550 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/utils.py:258: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

W0316 13:24:05.602858 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/main.py:295: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

W0316 13:24:05.813936 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/model.py:276: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

USING SKIP CONNECTIONS
W0316 13:24:06.421890 140715097528192 deprecation.py:323] From /content/CommonSenseMultiHopQA/src/elmo/model.py:520: init (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflow 2.0.
W0316 13:24:06.445024 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/model.py:564: The name tf.nn.rnn_cell.LSTMStateTuple is deprecated. Please use tf.compat.v1.nn.rnn_cell.LSTMStateTuple instead.

W0316 13:24:06.445283 140715097528192 deprecation.py:323] From /content/CommonSenseMultiHopQA/src/elmo/model.py:565: dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use keras.layers.RNN(cell), which is equivalent to this API
W0316 13:24:06.559309 140715097528192 deprecation.py:323] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/rnn_cell_impl.py:958: add_variable (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use layer.add_weight method instead.
W0316 13:24:06.836575 140715097528192 deprecation.py:506] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/rnn_cell_impl.py:962: calling init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
W0316 13:24:06.906634 140715097528192 deprecation.py:323] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/rnn.py:244: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
W0316 13:24:06.951582 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/model.py:589: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.

W0316 13:24:06.963304 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/model.py:534: The name tf.nn.rnn_cell.ResidualWrapper is deprecated. Please use tf.compat.v1.nn.rnn_cell.ResidualWrapper instead.

USING SKIP CONNECTIONS
W0316 13:24:09.593326 140715097528192 deprecation.py:506] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/util/dispatch.py:180: calling squeeze (from tensorflow.python.ops.array_ops) with squeeze_dims is deprecated and will be removed in a future version.
Instructions for updating:
Use the axis argument instead
W0316 13:24:09.599205 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/elmo.py:94: The name tf.get_collection is deprecated. Please use tf.compat.v1.get_collection instead.

W0316 13:24:09.599404 140715097528192 module_wrapper.py:139] From /content/CommonSenseMultiHopQA/src/elmo/elmo.py:95: The name tf.GraphKeys is deprecated. Please use tf.compat.v1.GraphKeys instead.

ELMo shapes:
[24, None, 1024]
[24, None, 1024]
[24, None, 1280]
W0316 13:24:09.654242 140715097528192 deprecation.py:323] From /content/CommonSenseMultiHopQA/src/tf_utils/ops.py:372: dropout (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dropout instead.
W0316 13:24:09.654836 140715097528192 deprecation.py:323] From /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/layers/core.py:271: apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use layer.__call__ method instead.
[24, None, 256]
[24, None, 256]
[24, None, 1024]
W0316 13:24:16.173249 140715097528192 deprecation.py:323] From /content/CommonSenseMultiHopQA/src/model_commonsense_nqa.py:198: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.Dense instead.
projected Tensor("attn_layer_0/commonsense_encoder/commonsense_proj/Relu:0", shape=(24, 40, 1024), dtype=float32)
[24, None, 1024]
[24, None, 256]
[24, None, 256]
[24, None, 1024]
projected Tensor("attn_layer_1/commonsense_encoder/commonsense_proj/Relu:0", shape=(24, 40, 1024), dtype=float32)
[24, None, 1024]
[24, None, 256]
[24, None, 256]
[24, None, 1024]
projected Tensor("attn_layer_2/commonsense_encoder/commonsense_proj/Relu:0", shape=(24, 40, 1024), dtype=float32)
[24, None, 1024]
1024
[24, None, 1024]
[24, None, 256]
[b x n x n]
[24, None, None]
[b x n x h]
[24, None, 256]
[24, None, 768]
[24, None, 1024]
[24, None, 1024]
W0316 13:24:34.837351 140715097528192 deprecation.py:323] From /content/CommonSenseMultiHopQA/src/tf_utils/ops.py:41: init (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflow 2.0.
W0316 13:24:34.958561 140715097528192 module_wrapper.py:139] From /usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/api/_v1/estimator/init.py:12: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.

<tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7ff9e515dd10>
Tensor("decode/decoder/while/BasicDecoderStep/decoder/attn_pointer_wrapper/checked_cell_output:0", shape=(24, 128), dtype=float32)
<tensorflow.python.layers.core.Dense object at 0x7ff9e5215310>
Tensor("decode/decoder/while/BasicDecoderStep/decoder/attn_pointer_wrapper/Softmax:0", shape=(24, 35965), dtype=float32)
Vocab dist history
<tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7ff9e5215210>
Traceback (most recent call last):
File "CommonSenseMultiHopQA/src/config.py", line 96, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python2.7/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python2.7/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "CommonSenseMultiHopQA/src/config.py", line 93, in main
m(config)
File "/content/CommonSenseMultiHopQA/src/main.py", line 62, in main
_test(config)
File "/content/CommonSenseMultiHopQA/src/main.py", line 297, in _test
model.build_graph()
File "/content/CommonSenseMultiHopQA/src/model_commonsense_nqa.py", line 317, in build_graph
train_outputs, train_state, self.train_final_lengths = decode(train_helper, 'decode')
File "/content/CommonSenseMultiHopQA/src/model_commonsense_nqa.py", line 313, in decode
maximum_iterations = self.max_decoder_length)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/contrib/seq2seq/python/ops/decoder.py", line 469, in dynamic_decode
swap_memory=swap_memory)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2753, in while_loop
return_same_structure)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2245, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2170, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2705, in
body = lambda i, lv: (i + 1, orig_body(*lv))
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/contrib/seq2seq/python/ops/decoder.py", line 412, in body
decoder_finished) = decoder.step(time, inputs, state)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/contrib/seq2seq/python/ops/basic_decoder.py", line 136, in step
cell_outputs, cell_state = self._cell(inputs, state)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/ops/rnn_cell_impl.py", line 244, in call
return super(RNNCell, self).call(inputs, state)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/layers/base.py", line 548, in call
outputs = super(Layer, self).call(inputs, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/base_layer.py", line 854, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
raise e.ag_error_metadata.to_exception(e)
TypeError: in converted code:
relative to /content/CommonSenseMultiHopQA/src/tf_utils:

pointer_wrapper.py:477 call  *
    attention, alignments = _compute_attention(
pointer_wrapper.py:54 _compute_attention  *
    alignments = attention_mechanism(

TypeError: __call__() got an unexpected keyword argument 'previous_alignments'

Can anyone please help me with this ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant