allenai / bi-att-flow

Bi-directional Attention Flow (BiDAF) network is a multi-stage hierarchical process that represents context at different levels of granularity and uses a bi-directional attention flow mechanism to achieve a query-aware context representation without early summarization.
http://allenai.github.io/bi-att-flow
Apache License 2.0
1.54k stars 679 forks source link

ValueError: Shapes (1, ?, ?, 100) and () are incompatible #113

Closed prathusha94 closed 5 years ago

prathusha94 commented 5 years ago

I am trying to execute the command "python -m basic.cli --mode train --noload --debug" . I initially had various errors with importing _linear and then the unknown flag error. SO I modified the file by adding the extra flags in this file https://github.com/allenai/bi-att-flow/pull/89/files.

And i'm facing this new issue now . Loaded 87507/87599 examples from train Loaded 10544/10570 examples from dev { 'answer_dir': <absl.flags._flag.Flag object at 0x7f31278781d0>, 'answer_func': <absl.flags._flag.Flag object at 0x7f312787d8d0>, 'answer_path': <absl.flags._flag.Flag object at 0x7f3127865c50>, 'batch_size': <absl.flags._flag.Flag object at 0x7f3127878748>, 'c2q_att': <absl.flags._flag.BooleanFlag object at 0x7f312787dac8>, 'char_count_th': <absl.flags._flag.Flag object at 0x7f312787ac18>, 'char_emb_size': <absl.flags._flag.Flag object at 0x7f3127878f60>, 'char_out_size': <absl.flags._flag.Flag object at 0x7f3127878eb8>, 'char_vocab_size': <absl.flags._flag.Flag object at 0x7f312787d390>, 'cluster': <absl.flags._flag.BooleanFlag object at 0x7f312787a438>, 'cpu_opt': <absl.flags._flag.BooleanFlag object at 0x7f312787a550>, 'data_dir': <absl.flags._flag.Flag object at 0x7f312f65c320>, 'data_filter': <absl.flags._flag.Flag object at 0x7f312787d6d8>, 'debug': <absl.flags._flag.BooleanFlag object at 0x7f31278785c0>, 'decay': <absl.flags._flag.Flag object at 0x7f312787aac8>, 'device': <absl.flags._flag.Flag object at 0x7f3127878240>, 'device_type': <absl.flags._flag.Flag object at 0x7f31278782b0>, 'dump_answer': <absl.flags._flag.BooleanFlag object at 0x7f312787a940>, 'dump_eval': <absl.flags._flag.BooleanFlag object at 0x7f312787a898>, 'dump_pickle': <absl.flags._flag.BooleanFlag object at 0x7f312787aa20>, 'dynamic_att': <absl.flags._flag.BooleanFlag object at 0x7f312787db38>, 'emb_mat': <absl.flags._flag.Flag object at 0x7f312787dbe0>, 'eval': <absl.flags._flag.BooleanFlag object at 0x7f31278786a0>, 'eval_dir': <absl.flags._flag.Flag object at 0x7f3127878128>, 'eval_path': <absl.flags._flag.Flag object at 0x7f3127865cf8>, 'eval_period': <absl.flags._flag.Flag object at 0x7f312787a710>, 'filter_heights': <absl.flags._flag.Flag object at 0x7f312787a0f0>, 'finetune': <absl.flags._flag.BooleanFlag object at 0x7f312787a160>, 'forward_name': <absl.flags._flag.Flag object at 0x7f3127865be0>, 'h': <tensorflow.python.platform.app._HelpFlag object at 0x7f312787dc18>, 'help': <tensorflow.python.platform.app._HelpFlag object at 0x7f312787dc18>, 'helpfull': <tensorflow.python.platform.app._HelpfullFlag object at 0x7f312787dcc0>, 'helpshort': <tensorflow.python.platform.app._HelpshortFlag object at 0x7f312787dd30>, 'hidden_size': <absl.flags._flag.Flag object at 0x7f3127878e10>, 'highway': <absl.flags._flag.BooleanFlag object at 0x7f312787a1d0>, 'highway_num_layers': <absl.flags._flag.Flag object at 0x7f312787a278>, 'init_lr': <absl.flags._flag.Flag object at 0x7f3127878b70>, 'input_keep_prob': <absl.flags._flag.Flag object at 0x7f3127878c18>, 'keep_prob': <absl.flags._flag.Flag object at 0x7f3127878cc0>, 'known_if_glove': <absl.flags._flag.BooleanFlag object at 0x7f312787d7b8>, 'len_opt': <absl.flags._flag.BooleanFlag object at 0x7f312787a4e0>, 'load': <absl.flags._flag.BooleanFlag object at 0x7f31278784a8>, 'load_ema': <absl.flags._flag.BooleanFlag object at 0x7f3127878630>, 'load_path': <absl.flags._flag.Flag object at 0x7f3127865da0>, 'load_step': <absl.flags._flag.Flag object at 0x7f3127878a90>, 'log_dir': <absl.flags._flag.Flag object at 0x7f3127878080>, 'log_period': <absl.flags._flag.Flag object at 0x7f312787a668>, 'logit_func': <absl.flags._flag.Flag object at 0x7f312787d860>, 'lower_word': <absl.flags._flag.BooleanFlag object at 0x7f312787d518>, 'max_num_sents': <absl.flags._flag.Flag object at 0x7f312787d048>, 'max_para_size': <absl.flags._flag.Flag object at 0x7f312787d2e8>, 'max_ques_size': <absl.flags._flag.Flag object at 0x7f312787d198>, 'max_sent_size': <absl.flags._flag.Flag object at 0x7f312787d0f0>, 'max_to_keep': <absl.flags._flag.Flag object at 0x7f312787a860>, 'max_word_size': <absl.flags._flag.Flag object at 0x7f312787d240>, 'mode': <absl.flags._flag.Flag object at 0x7f3127878438>, 'model_name': <absl.flags._flag.Flag object at 0x7f31972944e0>, 'num_epochs': <absl.flags._flag.Flag object at 0x7f3127878940>, 'num_gpus': <absl.flags._flag.Flag object at 0x7f3127878390>, 'num_sents_th': <absl.flags._flag.Flag object at 0x7f312787ad68>, 'num_steps': <absl.flags._flag.Flag object at 0x7f31278789e8>, 'out_base_dir': <absl.flags._flag.Flag object at 0x7f3127865b38>, 'out_channel_dims': <absl.flags._flag.Flag object at 0x7f312787a048>, 'out_dir': <absl.flags._flag.Flag object at 0x7f3127865ef0>, 'para_size_th': <absl.flags._flag.Flag object at 0x7f312787af60>, 'progress': <absl.flags._flag.BooleanFlag object at 0x7f312787a5c0>, 'q2c_att': <absl.flags._flag.BooleanFlag object at 0x7f312787da58>, 'ques_size_th': <absl.flags._flag.Flag object at 0x7f312787ae10>, 'run_id': <absl.flags._flag.Flag object at 0x7f312d56c4e0>, 'save_dir': <absl.flags._flag.Flag object at 0x7f3127865f98>, 'save_period': <absl.flags._flag.Flag object at 0x7f312787a7b8>, 'sent_size_th': <absl.flags._flag.Flag object at 0x7f312787acc0>, 'sh_logit_func': <absl.flags._flag.Flag object at 0x7f312787d940>, 'share_cnn_weights': <absl.flags._flag.BooleanFlag object at 0x7f312787a2b0>, 'share_lstm_weights': <absl.flags._flag.BooleanFlag object at 0x7f312787a358>, 'shared_path': <absl.flags._flag.Flag object at 0x7f3127865e48>, 'single': <absl.flags._flag.BooleanFlag object at 0x7f3127878550>, 'squash': <absl.flags._flag.BooleanFlag object at 0x7f312787d5c0>, 'swap_memory': <absl.flags._flag.BooleanFlag object at 0x7f312787d630>, 'test_num_batches': <absl.flags._flag.Flag object at 0x7f3127878898>, 'use_char_emb': <absl.flags._flag.BooleanFlag object at 0x7f312787d978>, 'use_glove_for_unk': <absl.flags._flag.BooleanFlag object at 0x7f312787d748>, 'use_word_emb': <absl.flags._flag.BooleanFlag object at 0x7f312787d9e8>, 'val_num_batches': <absl.flags._flag.Flag object at 0x7f31278787f0>, 'var_decay': <absl.flags._flag.Flag object at 0x7f312787a400>, 'vis': <absl.flags._flag.BooleanFlag object at 0x7f312787a9b0>, 'wd': <absl.flags._flag.Flag object at 0x7f3127878d68>, 'word_count_th': <absl.flags._flag.Flag object at 0x7f312787ab70>, 'word_emb_size': <absl.flags._flag.Flag object at 0x7f312787d438>, 'word_size_th': <absl.flags._flag.Flag object at 0x7f312787aeb8>, 'word_vocab_size': <absl.flags._flag.Flag object at 0x7f312787d4e0>} Traceback (most recent call last): File "/do_not_store/prathusha/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/do_not_store/prathusha/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/cli.py", line 123, in <module> tf.app.run() File "/do_not_store/prathusha/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/cli.py", line 120, in main m(config) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/main.py", line 23, in main _train(config) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/main.py", line 82, in _train models = get_multi_gpu_models(config) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/model.py", line 19, in get_multi_gpu_models model = Model(config, scope, rep=gpu_idx == 0) File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/model.py", line 58, in __init__ self._build_forward() File "/do_not_store/prathusha/bidaf/bi-att-flow/basic/model.py", line 95, in _build_forward xx = multi_conv1d(Acx, filter_sizes, heights, "VALID", self.is_train, config.keep_prob, scope="xx") File "/do_not_store/prathusha/bidaf/bi-att-flow/my/tensorflow/nn.py", line 179, in multi_conv1d concat_out = tf.concat(2, outs) File "/do_not_store/prathusha/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1122, in concat tensor_shape.scalar()) File "/do_not_store/prathusha/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 848, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (1, ?, ?, 100) and () are incompatible

Would appreciate any help regarding this.

fooSynaptic commented 5 years ago

encountered the sample issue, can someone help?

prathusha94 commented 5 years ago

I was getting this error because i was using tensor-flow version 1.2. The main branch works only with r0.11 . I'm now using the "dev" branch with tensor-flow 1.4 and it works perfectly fine , without any errors.

naveenjafer commented 4 years ago

@prathusha94 I am using tensorflow 1.4 with the dev branch, but am still running into the same error? Any pointers that you might have on how to fix this?