Fix tokenizer persistence using merged source implementation

#7
by edbeeching HF Staff - opened
Hugging Face Biology Research org

The custom tokenizer currently loses changes such as EOS <|im_end|> after saving and reloading. This copies tokenizer.py from the merged source tokenizer PR #9, commit b5d6e48f795d791388e712bde224f6d2668f9254.

The broader fix delegates standard metadata persistence to Transformers, preserves explicit caller overrides and AddedToken metadata, and saves DNA constructor settings. It retains DNA vocabulary-layout validation and standalone AutoTokenizer export. Legacy configuration fallbacks are removed.

Only tokenizer.py changes. The regression tests remain in the source tokenizer repository; model weights, tokenizer configuration, DNA encoding, and vocabulary IDs are unchanged.

Validation:

  • Source suite: 84 tests pass on Transformers 5.8.1 and 5.12.1.
  • Loaded this model's actual tokenizer configuration with the updated implementation and checked EOS/PAD, model length, padding side, AddedToken flags, chat template, DNA options, vocabulary IDs, and token masks through save/reload on Transformers 5.12.1.
edbeeching changed pull request status to merged

Sign up or log in to comment