question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Removing BPE when encoding with Sentencepiece

See original GitHub issue

I’m using SentencePiece instead of subword-nmt to tokenize the data. Problem: During evaluation the flag --remove-bpe is useless:

In SentencePiece

  1. the bpe-token changes from @@ to .
  2. first whitespace needs to be removed and second the bpe-token needs to be replaced with whitespace.

Currently you can fulfill (1) by passing “▁” as an argument for the --remove-bpe flag, but that does not eliminate the additional whitespace from (2).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
myleottcommented, Feb 1, 2019

Just following up on this, you can now detokenize sentencepiece with --remove-bpe=sentencepiece

0reactions
bkjcommented, Dec 11, 2020

Seeing the same problem here in the Romanian example – if you use --remove-bpe=sentencepiece in fairseq-generate it removes all of the spaces from the S T and D lines.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Removing BPE when encoding with Sentencepiece
I'm using SentencePiece instead of subword-nmt to tokenize the data. Problem: During evaluation the flag --remove-bpe is useless: In ...
Read more >
Using Sentencepiece/Byte Pair Encoding on Model - Support
As for inference, you'll want to tokenize your source with your subword model (BPE / sentencepiece), infer, and detokenize the inferred target.
Read more >
sentencepiece: Text Tokenization using Byte Pair Encoding ...
Description Unsupervised text tokenizer allowing to perform byte pair encoding and unigram modelling. Wraps the 'sentencepiece' library <https: ...
Read more >
Byte Pair Encoding (BPE)
Byte Pair Encoding (BPE) - Handling Rare Words with Subword Tokenization. NLP techniques, be it word embeddings or tfidf often works with a...
Read more >
Normalization and pre-tokenization - Hugging Face Course
... with Transformer models (Byte-Pair Encoding [BPE], WordPiece, and Unigram), ... The normalization step involves some general cleanup, such as removing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found