Spaces:
Paused
Paused
Download divscore/utils.py from RichardChenZH/DivScore: direct link, hf CLI and curl.
- Browser
- Download file 393 Bytes
-
https://huggingface.co/spaces/RichardChenZH/DivScore/resolve/main/divscore/utils.py
- Command line
-
hf download hf://spaces/RichardChenZH/DivScore/divscore/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/RichardChenZH/DivScore/resolve/main/divscore/utils.py
393 Bytes
| from transformers import AutoTokenizer | |
| def assert_tokenizer_consistency(model_id_1, model_id_2): | |
| identical_tokenizers = ( | |
| AutoTokenizer.from_pretrained(model_id_1).vocab | |
| == AutoTokenizer.from_pretrained(model_id_2).vocab | |
| ) | |
| if not identical_tokenizers: | |
| raise ValueError(f"Tokenizers are not identical for {model_id_1} and {model_id_2}.") | |