Given a merge list, implement a BPE tokenizer for a string

Tokenization & Embeddings1 / 4

Chapter 021 / 4

Tokenization & Embeddings

Given a merge list, implement a BPE tokenizer for a string

Easy
Target interface
bpe_encode(text, merges)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.