tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

Tokenization issue after upgrading to T2T 1.2.4

Open fstahlberg opened this issue 9 years ago • 3 comments

My t2t-decoder started to insert a blank symbol after each character after upgrading to T2T 1.2.4:

t2t-decoder
--data_dir=t2t_data/
--problems=translate_ende_wmt32k
--model=transformer
--hparams_set=transformer_base (...) INFO:tensorflow:Inference results INPUT: Airport building evacuated INFO:tensorflow:Inference results OUTPUT: F l u g h a f e n g e b <C3> <A4> u d e e v a k u i e r t

If I remove the blanks afterwards with

cat decodes | sed 's/ //g' | tr -d ' ' | sed 's// /g'

the output looks okay again. I have generated the data and trained the model with T2T 1.2.3.

fstahlberg avatar Oct 03 '17 09:10 fstahlberg

So apparently this commit is the problem. Is there a particular reason for doing this or was that pushed by mistake? And why not just do

decoded_outputs = targets_vocab.decode(_save_until_eos(outputs.flatten()))
if targets is not None:
  decoded_targets = targets_vocab.decode(_save_until_eos(targets.flatten()))

fstahlberg avatar Oct 03 '17 12:10 fstahlberg

I have the same problem, and I think it is a bug.

mudong0419 avatar Oct 13 '17 07:10 mudong0419

Fixed with 1.2.5, thanks

fstahlberg avatar Oct 16 '17 18:10 fstahlberg