tensorflow: TypeError: __init__() got an unexpected keyword argument 'dtype'

The module is models/rnn/translate I’m running

$ python -c 'import tensorflow as tf; print tf.__version__'
0.10.0rc0

I did the training:

python translate.py --data_dir /mnt/ft1/translate/ --train_dir /mnt/ft1/translate/ --size=256 --num_layers=2 --steps_per_checkpoint=50

and then run

python translate.py --decode --data_dir /mnt/ft1/translate/ --train_dir /mnt/ft1/translate/
Traceback (most recent call last):
  File "translate.py", line 290, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "translate.py", line 285, in main
    decode()
  File "translate.py", line 222, in decode
    model = create_model(sess, True)
  File "translate.py", line 131, in create_model
    dtype=dtype)
TypeError: __init__() got an unexpected keyword argument 'dtype'

My data dir looks like

-rw-rw-r-- 1 ubuntu ubuntu   21393583 Aug 31 15:21 dev-v2.tgz
-rw-rw-r-- 1 ubuntu ubuntu 3789873031 Aug 31 15:21 giga-fren.release2.en
lrwxrwxrwx 1 ubuntu ubuntu         30 Aug 31 15:17 giga-fren.release2.en.gz -> giga-fren.release2.fixed.en.gz
-rw-rw-r-- 1 ubuntu ubuntu 1214224978 Aug 30 19:55 giga-fren.release2.fixed.en.gz
-rw-rw-r-- 1 ubuntu ubuntu 1380871453 Aug 29 21:43 giga-fren.release2.fixed.fr.gz
-rw-rw-r-- 1 ubuntu ubuntu 4565271815 Aug 31 15:19 giga-fren.release2.fr
lrwxrwxrwx 1 ubuntu ubuntu         30 Aug 31 15:13 giga-fren.release2.fr.gz -> giga-fren.release2.fixed.fr.gz
-rw-rw-r-- 1 ubuntu ubuntu 2380084216 Sep  2 11:29 giga-fren.release2.ids40000.en
-rw-rw-r-- 1 ubuntu ubuntu 1222033408 Aug 31 17:17 giga-fren.release2.ids40000.fr
-rw-r--r-- 1 ubuntu ubuntu     332974 Dec 13  2013 newstest2013.en
-rw-r--r-- 1 ubuntu ubuntu     393465 Dec 13  2013 newstest2013.fr
-rw-rw-r-- 1 ubuntu ubuntu     231941 Sep  2 11:29 newstest2013.ids40000.en
-rw-rw-r-- 1 ubuntu ubuntu     268151 Sep  2 11:29 newstest2013.ids40000.fr
-rw-rw-r-- 1 ubuntu ubuntu 2595102720 Aug 31 10:53 training-giga-fren.tar
-rw-rw-r-- 1 ubuntu ubuntu     343512 Aug 31 16:54 vocab40000.en
-rw-rw-r-- 1 ubuntu ubuntu     380736 Aug 31 16:11 vocab40000.fr

The symlink in the data_dir are due to https://github.com/tensorflow/tensorflow/issues/4122

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@loretoparisi @gaurav5670 The files to look at are these:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/rnn/translate/seq2seq_model.py
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/rnn/translate/translate.py

These files seem to be out-of-sync somehow. Perhaps the easiest thing to do is to uninstall everything, and install the latest version of TensorFlow: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#download-and-setup

Let me know if you still have issues.

Somehow you’ve ended up with inconsistent versions of (at least) these two files:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/rnn/translate/seq2seq_model.py
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/rnn/translate/translate.py

Note the following commit on Aug 10, which added the dtype argument to the seq2seq_model.Seq2SeqModel constructor: https://github.com/tensorflow/tensorflow/commit/0e91b8b4db9c40bc8c45bcc69dd18e03d9f898a3

Based on the stack trace and error, it seems that your version of translate.py is after the Aug 10 commit, while your version of seq2seq_model.py is before the Aug 10 commit. Note that version 0.10 was before the Aug 10 commit; I’m not sure how your files got out-of-sync.

Please re-open if this doesn’t resolve your problem!