Implement Byte Pair Encoding from Scratch in PyTorch
Easyauto-graded
Build the BPE tokenizer algorithm that iteratively merges frequent character pairs to build a subword vocabulary.
Solve it
Check your answer
The grader verifies properties of your implementation, so a correct solution written differently from ours still passes.
pip install torchleet
from torchleet import check
check("byte-pair-encoder", get_vocab, get_stats, merge_vocab, byte_pair_encoding)