Unverified Commit 2171695c authored by Nouamane Tazi's avatar Nouamane Tazi Committed by GitHub
Browse files

quick fix SummarizationPipeline error messages (#14618)

* quick fix SummarizationPipeline error messages

Fix error messages to avoid spam errors, and errors of type:
`Your max_length is set to 50, but you input_length is only 46. You might consider decreasing max_length manually, e.g. summarizer('...', max_length=50)`

* correcto SummarizationPipeline error messages fixes
parent b66c5ab2
...@@ -227,16 +227,13 @@ class SummarizationPipeline(Text2TextGenerationPipeline): ...@@ -227,16 +227,13 @@ class SummarizationPipeline(Text2TextGenerationPipeline):
""" """
Checks whether there might be something wrong with given input with regard to the model. Checks whether there might be something wrong with given input with regard to the model.
""" """
if input_length < min_length // 2: if max_length < min_length:
logger.warning( logger.warning(f"Your min_length={min_length} must be inferior than your max_length={max_length}.")
f"Your min_length is set to {min_length}, but you input_length is only {input_length}. You might "
"consider decreasing min_length manually, e.g. summarizer('...', min_length=10)"
)
if input_length < max_length: if input_length < max_length:
logger.warning( logger.warning(
f"Your max_length is set to {max_length}, but you input_length is only {input_length}. You might " f"Your max_length is set to {max_length}, but you input_length is only {input_length}. You might "
"consider decreasing max_length manually, e.g. summarizer('...', max_length=50)" f"consider decreasing max_length manually, e.g. summarizer('...', max_length={input_length//2})"
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment