tensorflow / tensorflow/datasets

Specify TokenTextEncoder with custom tokenizer makes dataset reusing failed

Open
#603 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

Short description
Description of the bug.

Environment information

  • Operating System: Ubuntu 16.04
  • Python version: 3.6.8
  • tensorflow-datasets/tfds-nightly version: 1.0.2
  • tensorflow/tensorflow-gpu/tf-nightly/tf-nightly-gpu version: 1.13.1

Reproduction instructions

 BUILDER_CONFIGS = [
      DatasetConfig(
          name="words",
          version="1.0.0",
          description=("Uses word-level text encoding with "
                       "`tfds.features.text.TokenTextEncoder`"),
          text_encoder_config=tfds.features.text.TextEncoderConfig(
              encoder=tfds.features.text.TokenTextEncoder(
                  vocab_list=VOCAB,
                  tokenizer=Tokenizer(reserved_tokens=VOCAB))),
      ),
  ]

Link to logs

tensorflow.python.framework.errors_impl.NotFoundError: tensorflow_datasets/tacotron_dataset/phones/1.0.0.incompleteGTGY8F/text.text.tokens.tokenizer; No such file or directory

Expected behavior
Dataset can be reused when rerunning.

Additional context
When custom tokenizer is specified, it's saved to file for reusing. (https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/core/features/text/text_encoder.py#L331). But when reusing happens, it seems that wrong path is used to load tokenizer from file.

if self._user_defined_tokenizer is not None:
      self._tokenizer.save_to_file(filename)
      kwargs["tokenizer_file_prefix"] = filename

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect tensorflow_datasets/core/features/text/text_encoder.py around the custom tokenizer save and load logic, then reproduce the failure with the TokenTextEncoder and custom Tokenizer configuration shown. Done means a dataset using this configuration can be reused on rerun without the tokenizer path NotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
data, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.