-
Notifications
You must be signed in to change notification settings - Fork 401
[WIP] support different tokenizers #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dsv3-model
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,225 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove this file, i was just using to test
model_name = repo_id.split("/")[-1] | ||
model_dir = os.path.join(local_dir, model_name) | ||
|
||
# Common tokenizer files to download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be comprehensive and need user's double-check, eg, CLIP tokenizer used in FLUX needs special_tokens_map.json
and vocab.json
: https://huggingface.co/openai/clip-vit-large-patch14/tree/main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good point! Let me look into how image tokenizers work too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLIP is a text encoder instead of image encoder, and I feel like the "transformers" repo supports more tokenizers than the tokenizer
repo
python scripts/download_tokenizer.py --repo_id meta-llama/Meta-Llama-3.1-8B --hf_token=... | ||
|
||
# DeepSeek tokenizer (automatically downloads tokenizer.json and tokenizer_config.json) | ||
python scripts/download_tokenizer.py --repo_id deepseek-ai/DeepSeek-V3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, is hf_token
not required?
Requesting feedback since this will change the tokenizer directory for existing users. We need to add support more multiple tokenizers in titan (we currently only have the one used in llama3)
What happens currently:
scripts/download_tokenizer.py
assets/tokenizer/original/tokenizer.model
tokenizer.model
in the.toml
configs (https://github.com/pytorch/torchtitan/blob/main/torchtitan/models/llama3/train_configs/llama3_8b.toml#L21tokenizer.model
and wrap with our owntiktoken
tokenizer (https://github.com/pytorch/torchtitan/blob/main/torchtitan/datasets/tokenizer/tiktoken.py)New workflow:
scripts/download_tokenizer.py
assets/tokenizer/<model_name>/
.toml
configsPros:
Cons:
original/tokenizer.model