tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.5k stars 3.49k forks source link

decoding bug: LanguagemodelWikiNorefV8kL1k #561

Open rafaelbou opened 6 years ago

rafaelbou commented 6 years ago

Hi, I use this configuration for training and decoding the "title-to-text" problem:

PROBLEM=languagemodel_wiki_noref_v8k_l1k MODEL=transformer HPARAMS=transformer_base_v1

DATA_DIR=$HOME/t2t_data_textgen/ted TMP_DIR=/tmp/t2t_datagen_textgen/ted TRAIN_DIR=$HOME/t2t_train/$PROBLEM/$MODEL-$HPARAMS USER_DIR=/home/student-5/t2t_user/text_gen

mkdir -p $DATA_DIR $TMP_DIR $TRAIN_DIR

Generate data

t2t-datagen \ --data_dir=$DATA_DIR \ --tmp_dir=$TMP_DIR \ --problem=$PROBLEM \ --t2t_usr_dir=$USER_DIR

Train

t2t-trainer \ --data_dir=$DATA_DIR \ --problems=$PROBLEM \ --model=$MODEL \ --hparams_set=$HPARAMS \ --hparams='batch_size=1024' \ --output_dir=$TRAIN_DIR \ --t2t_usr_dir=$USER_DIR

Decode

BEAM_SIZE=4 ALPHA=0.6 DECODE_FILE=$DATA_DIR/test.txt

t2t-decoder \ --data_dir=$DATA_DIR \ --problems=$PROBLEM \ --model=$MODEL \ --hparams_set=$HPARAMS \ --output_dir=$TRAIN_DIR \ --decode_hparams="beam_size=$BEAM_SIZE,alpha=$ALPHA" \ --decode_from_file=$DECODE_FILE \ --decode_to_file=test_output.txt \ --t2t_usr_dir=$USER_DIR

train finished successfully but when I try decoding I get the next error: INFO:tensorflow:Beam Decoding with beam size 4 Traceback (most recent call last): File "/usr/local/bin/t2t-decoder", line 16, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/usr/local/bin/t2t-decoder", line 12, in main t2t_decoder.main(argv) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/bin/t2t_decoder.py", line 105, in main decode(estimator, hp, decode_hp) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/bin/t2t_decoder.py", line 79, in decode decode_hp, FLAGS.decode_to_file) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/decoding.py", line 252, in decode_from_file for result in result_iter: File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 411, in predict features, None, model_fn_lib.ModeKeys.PREDICT, self.config) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 694, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/t2t_model.py", line 754, in wrapping_model_fn use_tpu=use_tpu) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/t2t_model.py", line 797, in estimator_model_fn return model.estimator_spec_predict(features) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/t2t_model.py", line 889, in estimator_spec_predict decode_length=decode_hparams.extra_length) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/utils/t2t_model.py", line 418, in infer features, decode_length, beam_size, top_beams, alpha) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/models/transformer.py", line 202, in _beam_decode beam_size, top_beams, alpha) File "/usr/local/lib/python2.7/dist-packages/tensor2tensor/models/transformer.py", line 250, in _fast_decode input_modality = self._problem_hparams.input_modality["inputs"] KeyError: 'inputs'

I have no clue why is it happening. any help?

thanks, Rafael.

stefan-it commented 6 years ago

@rafaelbou Does still bug still exists in the latest version of tensor2tensor?