Getting error even after setting the max_length

I have set the max length as follows:

model_name = "sagard21/python-code-explainer"
tokenizer = AutoTokenizer.from_pretrained(model_name, padding=True, max_length=50)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name, max_length=50)
config = AutoConfig.from_pretrained(model_name)
pipe = pipeline("summarization", model=model_name, config=config, tokenizer=tokenizer)

Yet I am still getting this error:

Your max_length is set to 200, but your input_length is only 80. Since this is a summarization task, where outputs shorter than the input are typically wanted, you might consider decreasing max_length manually, e.g. summarizer(‘…’, max_length=40)

What am i doing wrong?

The purpose of summarization is to express or rephrase something in a short and clear form. You set the maximum length to 200, which is an upper limit on tokens a model could generate. It doesn’t have to but technically it could output text that is longer than your input (80). In the context of summarization it’s not intended to generate more text when summarizing something rather generate less.

So better keep the max length below the input length in order to get the desired outcome