# Convert huggingface tokenizer into sentencepiece format

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fconvert-huggingface-tokenizer-into-sentencepiece-format%2F85682%3E%5C
**Category:** 🤗Tokenizers\
**Created:** [May 7, 2024, 5:31pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fconvert-huggingface-tokenizer-into-sentencepiece-format%2F85682 "2024-05-07T17:31:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaphaelKalandadze](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/raphaelkalandadze/32/26740_2.png) [@RaphaelKalandadze](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRaphaelKalandadze)%5C
**Post date:** [May 7, 2024, 5:31pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fconvert-huggingface-tokenizer-into-sentencepiece-format%2F85682%2F1 "2024-05-07T17:31:42Z")

</div>

I have a huggingface tokenizer for the BERT model (google-bert/bert-base-cased) which includes three files: tokenizer.json, tokenizer\_config.json, and vocab.txt. I would like to convert this tokenizer into the SentencePiece tokenizer format, which uses a single .model file.  
How can I perform this conversion?

---

<div class="post-metadata">

**Author:** ![bh4](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@bh4](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbh4)%5C
**Post date:** [November 27, 2024, 2:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fconvert-huggingface-tokenizer-into-sentencepiece-format%2F85682%2F2 "2024-11-27T14:06:50Z")

</div>

Similar problem here. I would like to convert smollm2-360m hugging face tokenizer to sentencepiece format but couldn’t find any way of doing so. Can anyone guide?
