tensor2tensor
tensor2tensor copied to clipboard
AttributeError: 'HParams' object has no attribute 'decode_reference'
Description
...when i run t2t-decoder, an error occur, why and what happen? here is the command: t2t-decoder --data_dir=data --problem=translate_enzh_wmt32k --model=transformer --hparams_set=transformer_base_single_gpu --output_dir=train --decode_hparams="beam_size=4,alpha=0.6" --decode_from_file=test10.10 --decode_to_file=translation_test.en
and the error:
INFO:tensorflow:Inference results OUTPUT: 翻版
INFO:tensorflow:Inference results INPUT: C
INFO:tensorflow:Inference results OUTPUT: C
INFO:tensorflow:Inference results INPUT: B
INFO:tensorflow:Inference results OUTPUT: B
INFO:tensorflow:Inference results INPUT: A
INFO:tensorflow:Inference results OUTPUT: A
INFO:tensorflow:Elapsed Time: 5906.26919
INFO:tensorflow:Averaged Single Token Generation Time: 0.0030321
INFO:tensorflow:Writing decodes into translation_test.en
INFO:tensorflow:Running decode hooks.
Traceback (most recent call last):
File "/home/zhangshaoyuan/anaconda3/bin/t2t-decoder", line 17, in
Environment information
Name: tensor2tensor Version: 1.9.0 Name: tensorflow Version: 1.11.0
anyone tell me why? thanks very much!
I met the same problem, too
Same problem with t2t-decoder;
however, the translation file can be produced eventually.
One more finding, when using --checkpoint_path
rather than --output_dir,
there will be no error.
One more finding, when using
--checkpoint_path
rather than--output_dir,
there will be no error.
Yes, I tried this approach, it works...
More specific, change --output_dir=model-dir
to --checkpoint_path=model-dir/model-name
, model-name without extension name (eg. --checkpoint_path=./basemodule/model.ckpt-180000
. Hope my exp. can help more people:smile:
My platform info:
Ubuntu 18.04.5 LTS Linux spc 5.4.0-62-generic #70~18.04.1-Ubuntu SMP Tue Jan 12 17:18:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
tensor2tensor 1.9.0 tensorboard 1.12.2 tensorflow-gpu 1.12.0 tensorflow-probability 0.7.0