Is `preserve_unused_token` working when calling `bert_vocab_from_dataset`?
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 379
- Avg merge
- 3h 30m
- Merged PRs (30d)
- 8
Description
If I got it right, then this command:
bert_vocab.bert_vocab_from_dataset(
dataset=tf.data.Dataset.from_tensor_slices(['I am [unused1].']),
vocab_size=100,
reserved_tokens=[],
bert_tokenizer_params=dict(lower_case=False, preserve_unused_token=True),
learn_params = None
)
should return [unused1] as a token, but rather I get
['.', '1', 'I', '[', ']', 'a', 'd', 'e', 'm', 'n', 's', 'u', '##.', '##1', '##I', '##[', '##]', '##a', '##d', '##e', '##m', '##n', '##s', '##u']
which is exactly what was expected if preserve_unused_token was being ignored.
Am I doing something wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided bert_vocab.bert_vocab_from_dataset reproducer with the shown dataset and tokenizer parameters. Trace how preserve_unused_token is handled during vocabulary generation, and compare the result with the expected inclusion of [unused1]; done means confirming whether the behavior is intentional or identifying the relevant fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100