# Token restriction via the Huggin face API

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-restriction-via-the-huggin-face-api%2F112370%3E%5C
**Category:** Beginners\
**Created:** [October 16, 2024, 12:33pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-restriction-via-the-huggin-face-api%2F112370 "2024-10-16T12:33:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Locon213](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@Locon213](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLocon213)%5C
**Post date:** [October 16, 2024, 12:33pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-restriction-via-the-huggin-face-api%2F112370%2F1 "2024-10-16T12:33:15Z")

</div>

Hi, I use the Botpress service for my chatbots. And I have just started using integration with Huggin face. But what exactly is the matter is that the number of tokens is limited to me, that is, My chatbots simply do not add. The same thing is observed on checking the model through the API, that is, on the model page. Who can help me figure this out and increase the number of tokens for models. Ps. The translation was done by Google translate

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [October 16, 2024, 1:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-restriction-via-the-huggin-face-api%2F112370%2F2 "2024-10-16T13:05:47Z")

</div>

I’m also DeepL. No problem.  
Normally this is the way to increase max\_new\_tokens, but without a way to specify it on the botpress side, there is no way to do it.

> [@How do I increase max\_new\_tokens](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-increase-max-new-tokens%2F43098%2F4)%3A
>
> @gkrishnan I’m late to the post but you can always manually pass in the model/pipeline: from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer from langchain.llms import HuggingFacePipeline model = AutoModelForCausalLM.from\_pretrained(model\_path) tokenizer = AutoTokenizer.from\_pretrained(model\_path) gen = pipeline('text-generation', model=model, tokenizer=tokenizer, max\_new\_tokens=200) llama\_llm = HuggingFacePipeline(pipeline=gen)

> [@Confused about max\_length and max\_new\_tokens](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fconfused-about-max-length-and-max-new-tokens%2F30892%2F6)%3A
>
> I know I’m late now. But for any future preferences. what the max\_length and max\_new\_tokens do. In max\_length we get the maximum length including the input and output tokens. But in max\_new\_tokens we get the maximum output excluding the output. Let me show you using the code import torch from transformers import AutoModelForCausalLM, AutoTokenizer,AutoModelForSeq2SeqLM torch.set\_default\_device("cuda") model = AutoModelForCausalLM.from\_pretrained("microsoft/phi-2", torch\_dtype="auto", tru…

The botpress people seem to be on HF, so there’s always the option of sending them a direct mentions and asking them. (@+username)

> **[Botpress (Botpress)](https://huggingface.co/Botpress)**
>
> NLP, Conversational AI
