bi-att-flow icon indicating copy to clipboard operation
bi-att-flow copied to clipboard

ValueError when setting finetune to True

Open Arminius4 opened this issue 6 years ago • 2 comments

Hi there,

when running

python -m basic.cli --mode train --noload --debug --finetune True

I get

'word_vocab_size': 71939} 0%| | 0/2 [00:00<?, ?it/s] Traceback (most recent call last): File "/anaconda3/envs/py35/lib/python3.5/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/anaconda3/envs/py35/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/i863717/Desktop/bi-att-flow/basic/cli.py", line 109, in tf.app.run() File "/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "/Users/i863717/Desktop/bi-att-flow/basic/cli.py", line 106, in main m(config) File "/Users/i863717/Desktop/bi-att-flow/basic/main.py", line 23, in main _train(config) File "/Users/i863717/Desktop/bi-att-flow/basic/main.py", line 99, in _train loss, summary, train_op = trainer.step(sess, batches, get_summary=get_summary) File "/Users/i863717/Desktop/bi-att-flow/basic/trainer.py", line 69, in step sess.run([self.loss, self.summary, self.train_op], feed_dict=feed_dict) File "/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 717, in run run_metadata_ptr) File "/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 894, in _run % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (0,) for Tensor 'model_0/new_emb_mat:0', which has shape '(?, 100)'.

However,

python -m basic.cli --mode train --noload --debug

(which is the first command from README section 2) works perfectly fine!

Lukas

Arminius4 avatar Oct 06 '17 23:10 Arminius4

same problem

dengyuning avatar Oct 10 '17 02:10 dengyuning

I was able to avoid this problem by setting known_if_glove to False

python -m basic.cli --mode train --noload --debug --finetune True --known_if_glove False

in basic/read_data.py line 188

if count > config.word_count_th or (config.known_if_glove and word in word2vec_dict))}

this parameter is checked in the condition for filling the shared dictionary.

In basic/cli.py there seems to be a mistake

flags.DEFINE_bool("known_if_glove", True, "consider as known if present in glove [False]")

as the default given in the explanatory string does not match the actual code, opposed to all the other lines. After changing it to False, it worked!

Lukas

Arminius4 avatar Oct 10 '17 17:10 Arminius4