# Chapter 1 questions

**URL:** <https://discuss.huggingface.co/t/chapter-1-questions/6797>\
**Category:** Course\
**Created:** [June 14, 2021, 2:50pm UTC](https://discuss.huggingface.co/t/chapter-1-questions/6797 "2021-06-14T14:50:50Z")\
**Posts on this page:** 1\
**Showing post:** 113

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [May 28, 2025, 7:06am UTC](https://discuss.huggingface.co/t/chapter-1-questions/6797/113 "2025-05-28T07:06:47Z")

</div>

I tend to use `max_new_tokens`.

> [@Confused about max\_length and max\_new\_tokens](https://discuss.huggingface.co/t/confused-about-max-length-and-max-new-tokens/30892):
>
> I’m trying to run the example code from flan-t5-small: from transformers import T5Tokenizer, T5ForConditionalGeneration tokenizer = T5Tokenizer.from\_pretrained("google/flan-t5-base") model = T5ForConditionalGeneration.from\_pretrained("google/flan-t5-base") input\_text = "translate English to German: How old are you?" input\_ids = tokenizer(input\_text, return\_tensors="pt").input\_ids outputs = model.generate(input\_ids) print(tokenizer.decode(outputs[0])) I’m getting the following warning: Us…

> <https://github.com/huggingface/transformers/issues/21369>
>
> \### System Info
> 
> \- \`transformers\` version: 4.27.0.dev0
> \- Platform: Windows-10…-10.0.19044-SP0
> \- Python version: 3.10.4
> \- Huggingface\_hub version: 0.12.0
> \- PyTorch version (GPU?): 1.13.1+cpu (False)
> \- Tensorflow version (GPU?): not installed (NA)
> \- Flax version (CPU?/GPU?/TPU?): not installed (NA)
> \- Jax version: not installed
> \- JaxLib version: not installed
> \- Using GPU in script?: No
> \- Using distributed or parallel set-up in script?: No
> 
> 
> \### Who can help?
> 
> @gante I believe.
> 
> \### Information
> 
> \- \[\] The official example scripts
> \- \[X\] My own modified scripts
> 
> \### Tasks
> 
> \- \[X\] An officially supported task in the \`examples\` folder (such as GLUE/SQuAD, ...)
> \- \[\] My own task or dataset (give details below)
> 
> \### Reproduction
> 
> 1. Install transformers
> 2. Run the following script 
> \`\`\`
> from transformers import pipeline
> 
> summarizer = pipeline("summarization", max\_new\_tokens=50)
> 
> prompt = "text to summarize"
> summary = summarizer(prompt)
> \`\`\`
> 3. It crashes with the following error:
> 
> \> ValueError: Both \`max\_new\_tokens\` and \`max\_length\` have been set but they serve the same purpose -- setting a limit to the generated output length. Remove one of those arguments. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main\_classes/text\_generation)
> 
> 
> \### Expected behavior
> 
> Expected behavior is that the script should run. I only set \`max\_new\_tokens\` and not \`max\_length\`.
> This might seem like a duplicate of https://github.com/huggingface/transformers/issues/20894 but the issue persists even after installing the latest version of transformers with the fix for that issue.

---

_[View the full topic](https://discuss.huggingface.co/t/chapter-1-questions/6797)._
