# Copyright 2026 DoL contributors # Licensed under the Apache License, Version 2.0. """Hugging Face adapter for the versioned DoL dual-track tokenizer. The adapter deliberately contains no alternative tokenization algorithm. It loads the exact MorphBPE/general-BPE assets from ``bundle_v3b`` and exposes the small interface required by the official Transformers causal-LM example. """ from __future__ import annotations import hashlib import json import os import shutil from pathlib import Path from transformers import PreTrainedTokenizer from Tokenizer.unified.bundle import TokenizerBundle, TokenizerBundleConfig MODEL_VOCAB_SIZE = 65_536 EXPECTED_SPECIAL_IDS = { "": 0, "": 1, "": 2, "": 3, "": 4, "": 5, "": 6, "": 7, "": 8, "