Replies: 1 comment
-
|
This is one of those Megatron-LM “hidden contract” areas where the code is clearer than the documentation. Let’s break it down properly. 🧠 1. What “our tokenizer JSON” actually meansWhen Megatron says:
it does NOT mean a generic HuggingFace tokenizer file. It specifically means:
📦 2. Expected JSON formatThe file you pass via: --tokenizer-model path/to/tokenizer.jsonshould contain mergeable ranks + vocabulary mapping, typically like: {
"version": "1",
"pat_str": "...",
"mergeable_ranks": {
"b'Ġt'": 0,
"b'he'": 1,
"b'll'": 2
},
"special_tokens": {
"<|endoftext|>": 100257,
"<|pad|>": 100258
}
}🔥 3. What Megatron actually uses from itInside: reload_mergeable_ranks(path)Megatron extracts: ✔️ Required fields:1.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I noticed that ML now support TikTokenizer by setting the --tokenizer-type argument. But I do not know what i should set with --tokenizer-model. I have checked the source code and find that we should pass a json file, and the function below will convert the json file to Tiktoken format.
Megatron-LM/megatron/training/tokenizer/tokenizer.py
Line 581 in 772faca
The comment says " Reload our tokenizer JSON file and convert it to Tiktoken format." What does "our tokenizer JSON" means? which format should the json file be?
Beta Was this translation helpful? Give feedback.
All reactions