"""Pinned Qwen3 split/token/request IDs and local DS4 family controls; no inference.""" import argparse,hashlib,json,os,struct,subprocess,sys from pathlib import Path parser=argparse.ArgumentParser(description=__doc__) parser.add_argument('checkout',type=Path) parser.add_argument('root',type=Path) parser.add_argument('out',type=Path) parser.add_argument('--ds4',type=Path) parser.add_argument('--glm',type=Path) parser.add_argument('--deepseek',type=Path) args=parser.parse_args() checkout,root,out=args.checkout,args.root,args.out assert subprocess.check_output(['git','-C',str(checkout),'rev-parse','HEAD'],text=True).strip()=='9882703f3105363ddc37eca9f97aa09a1d387112' sys.path.insert(0,str(checkout)) os.environ.update(HF_HUB_OFFLINE='1',TRANSFORMERS_OFFLINE='1') from tokenizers import Regex,Tokenizer as BackendTokenizer,pre_tokenizers from mtplx.runtime import _QWEN3_PRETOKENIZER_SPLIT,_load_tokenizer_resilient from mtplx.server import openai as server out.mkdir(parents=True,exist_ok=True) tokenizer=_load_tokenizer_resilient(root,json.loads((root/'config.json').read_text())) component=BackendTokenizer.from_str(tokenizer.backend_tokenizer.to_str()) component.normalizer=None split=pre_tokenizers.Split(Regex(_QWEN3_PRETOKENIZER_SPLIT),behavior='isolated') scalars=[chr(i) for i in range(0x110000) if not 0xd800<=i<=0xdfff] text=''.join('A'+c+'A ' for c in scalars) h=hashlib.sha256();count=0 for piece,_ in split.pre_tokenize_str(text): b=piece.encode(); h.update(struct.pack('