# Tokenizer issue in Huggingface Inference on uploaded models

**URL:** <https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724>\
**Category:** Beginners\
**Created:** [February 19, 2021, 10:40am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724 "2021-02-19T10:40:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bala1802](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@bala1802](https://discuss.huggingface.co/u/bala1802)\
**Post date:** [February 19, 2021, 10:40am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/1 "2021-02-19T10:40:16Z")

</div>

While inferencing on the uploaded model in huggingface, I am getting the below error,

**Can’t load tokenizer using from\_pretrained, please update its configuration: Can’t load tokenizer for ‘bala1802/model\_1\_test’. Make sure that: - ‘bala1802/model\_1\_test’ is a correct model identifier listed on ‘[Models - Hugging Face](https://huggingface.co/models)’ - or ‘bala1802/model\_1\_test’ is the correct path to a directory containing relevant tokenizer files**

How to configure the tokenizer in config file ?

The configuration file looks like below,

> {  
> “\_name\_or\_path”: “gpt2”,  
> “activation\_function”: “gelu\_new”,  
> “architectures”: [  
> “GPT2LMHeadModel”  
> ],  
> “attn\_pdrop”: 0.1,  
> “bos\_token\_id”: 50256,  
> “embd\_pdrop”: 0.1,  
> “eos\_token\_id”: 50256,  
> “gradient\_checkpointing”: false,  
> “initializer\_range”: 0.02,  
> “layer\_norm\_epsilon”: 1e-05,  
> “model\_type”: “gpt2”,  
> “n\_ctx”: 1024,  
> “n\_embd”: 768,  
> “n\_head”: 12,  
> “n\_inner”: null,  
> “n\_layer”: 12,  
> “n\_positions”: 1024,  
> “resid\_pdrop”: 0.1,  
> “summary\_activation”: null,  
> “summary\_first\_dropout”: 0.1,  
> “summary\_proj\_to\_labels”: true,  
> “summary\_type”: “cls\_index”,  
> “summary\_use\_proj”: true,  
> “task\_specific\_params”: {  
> “text-generation”: {  
> “do\_sample”: true,  
> “max\_length”: 50  
> }  
> },  
> “transformers\_version”: “4.3.2”,  
> “use\_cache”: true,  
> “vocab\_size”: 50257  
> }

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](https://discuss.huggingface.co/u/lewtun)\
**Post date:** [February 20, 2021, 7:27pm UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/2 "2021-02-20T19:27:36Z")

</div>

Hi @bala1802, I just tried your text generation model on the inference API ([link](https://huggingface.co/bala1802/model_1_test)) and it seems to work without any error - perhaps you found a way to solve your problem?

---

<div class="post-metadata">

**Author:** ![bala1802](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@bala1802](https://discuss.huggingface.co/u/bala1802)\
**Post date:** [February 21, 2021, 8:54am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/3 "2021-02-21T08:54:44Z")

</div>

Hi,

Yes I uploaded the missing tokenizer files. Now it’s working.

Thanks for getting back

---

<div class="post-metadata">

**Author:** ![nickmuchi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nickmuchi/32/29420_2.png) [@nickmuchi](https://discuss.huggingface.co/u/nickmuchi)\
**Post date:** [January 4, 2022, 6:55am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/4 "2022-01-04T06:55:17Z")

</div>

Hi I am facing the same error, I only have the config.json and tf\_model.h5 files, is there any I need to upload?

---

<div class="post-metadata">

**Author:** ![nickmuchi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nickmuchi/32/29420_2.png) [@nickmuchi](https://discuss.huggingface.co/u/nickmuchi)\
**Post date:** [January 4, 2022, 10:54am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/5 "2022-01-04T10:54:37Z")

</div>

I have also tried push\_to\_hub() and I am getting the below error:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/1/1b90f78bd34c8a5e45567ee10bedccf343a72be8.png)

Already pip installed git-lfs via jupyter lab and logged in to notebook

---

<div class="post-metadata">

**Author:** ![Hexye](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hexye/32/13247_2.png) [@Hexye](https://discuss.huggingface.co/u/Hexye)\
**Post date:** [December 28, 2022, 11:53am UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/6 "2022-12-28T11:53:11Z")

</div>

have you found out? I’m having the same issue

---

<div class="post-metadata">

**Author:** ![Unspoiled-Egg](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/unspoiled-egg/32/25070_2.png) [@Unspoiled-Egg](https://discuss.huggingface.co/u/Unspoiled-Egg)\
**Post date:** [April 24, 2023, 2:58pm UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/7 "2023-04-24T14:58:45Z")

</div>

Hi, @lewtun I used push\_to\_hub() on finetuned bart model and I am getting similar error.

---

<div class="post-metadata">

**Author:** ![saicharan8](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@saicharan8](https://discuss.huggingface.co/u/saicharan8)\
**Post date:** [January 9, 2024, 2:00pm UTC](https://discuss.huggingface.co/t/tokenizer-issue-in-huggingface-inference-on-uploaded-models/3724/9 "2024-01-09T14:00:16Z")

</div>

just add the tokenizer and related files from pretrained model’s directory to our model directory. it worked
