tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

AssertionError: Token substring not found in subtoken vocabulary

Open xujunrt opened this issue 9 years ago • 6 comments

xujunrt avatar Sep 08 '17 02:09 xujunrt

I've also stumbled on this. For some context on my problem, I'm working on using a custom message and response dataset with the EN_BPE_TOK space using the generator_utils.get_or_generate_txt_vocab vocab builder.

soaxelbrooke avatar Sep 08 '17 04:09 soaxelbrooke

Looks like this was caused by symlinking the data, and worked when I copied the data files to the specified location.

soaxelbrooke avatar Sep 08 '17 04:09 soaxelbrooke

Sorry can you please advise where did you copy the data? I am also getting this error while testing tensor2tensor on my own data. I put the data in t2t_data directory which is my $DATA_DIR.

vishalnus avatar Sep 28 '17 07:09 vishalnus

T2T expects the input/downloaded data in t2t_tmp dir. The t2t_data dir contains the preprocessed data in TFRecords and the vocabularies.

martinpopel avatar Sep 28 '17 07:09 martinpopel

yes actually in the experiment I assigned t2t_tmp=$DATA_DIR. So both t2t_tmp and t2t_data are same directory. In other words, my preprocessed data and vocabularies are present in DATA_DIR.

Actually i get the error during shuffling phase, as I get the unshuffled data.

INFO:tensorflow:Generating case 100000. INFO:tensorflow:Generating case 200000. INFO:tensorflow:Generating case 300000. INFO:tensorflow:Generating case 400000. INFO:tensorflow:Generating case 500000. INFO:tensorflow:Generating case 600000. INFO:tensorflow:Generating case 700000. INFO:tensorflow:Generating case 800000. INFO:tensorflow:Generating case 900000. INFO:tensorflow:Generating case 1000000. INFO:tensorflow:Generating case 1100000. INFO:tensorflow:Generating case 1200000. Traceback (most recent call last): File "/usr/local/bin/t2t-datagen", line 213, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/usr/local/bin/t2t-datagen", line 179, in main generate_data_for_registered_problem(problem) File "/usr/local/bin/t2t-datagen", line 209, in generate_data_for_registered_problem task_id=task_id) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/problem.py", line 594, in generate_data self.generator(data_dir, tmp_dir, False), dev_paths) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/generator_utils.py", line 466, in generate_dataset_and_shuffle generate_files(dev_gen, dev_paths) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/generator_utils.py", line 143, in generate_files for case in generator: File "/home/tranformer/t2t_usr/googdom.py", line 148, in token_generator target_ints = token_vocab.encode(target.strip()) + eos_list File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/text_encoder.py", line 406, in encode tokenizer.encode(native_to_unicode(raw_text))) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/text_encoder.py", line 436, in _tokens_to_subtoken_ids _escape_token(token, self._alphabet))) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/text_encoder.py", line 499, in _escaped_token_to_subtoken_ids for subtoken in self._escaped_token_to_subtoken_strings(escaped_token) File "/usr/local/lib/python3.5/dist-packages/tensor2tensor/data_generators/text_encoder.py", line 485, in _escaped_token_to_subtoken_strings assert False, "Token substring not found in subtoken vocabulary."

Please note that my t2t_usr has googdom.py which is similar to wmt.py

vishalnus avatar Sep 28 '17 07:09 vishalnus

Hi, I encountered this problem today, I put my customized vocab file to t2t_data, but the error still exists.

yourSylvia avatar Mar 21 '19 13:03 yourSylvia