Issue with saving a pipeline

Hi. I started using this amazing tool but I have an issue saving a pipeline.
This is what I am doing:

generation_config = GenerationConfig.from_pretrained(model_id)
pipe = pipeline(
“text-generation”,
model=model,
tokenizer=tokenizer,
max_length=MAX_NEW_TOKENS,
temperature=0.2,
repetition_penalty=1.15,
generation_config=generation_config,
)
pipe.save_pretrained(“./DIR_TEST/”)

Although a very similar code works for other pipelines, this one gives me the following error:

ValueError: The generation config instance is invalid – .validate() throws warnings and/or exceptions. Fix these issues to save the configuration.

I searched online, but I did not find the correct answer, nor I understand what is wrong: the “generation_config” is provided to the pipeline, and I can actually see that the file config.json is created in folder /DIR_TEST before the error…

Thank you in advance for your help.