"docs/source/en/model_doc/efficientnet.md" did not exist on "c9a0671477b06780840ab2f5ff39006e0952be3d"
Unverified Commit da68fd69 authored by lewtun's avatar lewtun Committed by GitHub
Browse files

Relax `eos_token_id < 0` checks in `generate()` from `ValueError` to warning (#22472)

* Relax  checks from  to warning

* Fix style

* Replace warnings with logger

* Use warning vs warn
parent 0fe6c6bd
......@@ -106,12 +106,12 @@ class MinLengthLogitsProcessor(LogitsProcessor):
def __init__(self, min_length: int, eos_token_id: Union[int, List[int]]):
if not isinstance(min_length, int) or min_length < 0:
raise ValueError(f"`min_length` has to be a positive integer, but is {min_length}")
raise ValueError(f"`min_length` has to be a non-negative integer, but is {min_length}")
if isinstance(eos_token_id, int):
eos_token_id = [eos_token_id]
if not all([isinstance(i, int) for i in eos_token_id]) or any([i < 0 for i in eos_token_id]):
raise ValueError(f"`eos_token_id` has to be a list of positive integers, but is {eos_token_id}")
logger.warning(f"`eos_token_id` has to be a list of positive integers, but is {eos_token_id}")
self.min_length = min_length
self.eos_token_id = eos_token_id
......@@ -148,7 +148,7 @@ class MinNewTokensLengthLogitsProcessor(LogitsProcessor):
if isinstance(eos_token_id, int):
eos_token_id = [eos_token_id]
if not all([isinstance(i, int) for i in eos_token_id]) or any([i < 0 for i in eos_token_id]):
raise ValueError(f"`eos_token_id` has to be a list of positive integers, but is {eos_token_id}")
logger.warning(f"`eos_token_id` has to be a list of positive integers, but is {eos_token_id}")
self.prompt_length_to_skip = prompt_length_to_skip
self.min_new_tokens = min_new_tokens
......
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