# Convert huggingface tokenizer into sentencepiece format

**URL:** <https://discuss.huggingface.co/t/convert-huggingface-tokenizer-into-sentencepiece-format/85682>\
**Category:** 🤗Tokenizers\
**Created:** [May 7, 2024, 5:31pm UTC](https://discuss.huggingface.co/t/convert-huggingface-tokenizer-into-sentencepiece-format/85682 "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](https://discuss.huggingface.co/u/RaphaelKalandadze)\
**Post date:** [May 7, 2024, 5:31pm UTC](https://discuss.huggingface.co/t/convert-huggingface-tokenizer-into-sentencepiece-format/85682/1 "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](https://discuss.huggingface.co/u/bh4)\
**Post date:** [November 27, 2024, 2:06pm UTC](https://discuss.huggingface.co/t/convert-huggingface-tokenizer-into-sentencepiece-format/85682/2 "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?
