PaddlePaddle/PaddleOCR · error · ValueError
Make sure that all the required parameters: {list(function_a
Error message
Make sure that all the required parameters: {list(function_args.keys())} for {processor.__class__} are passed to the logits processor. What it means
LogitsProcessorList.__call__ inspects each processor's __call__ signature; any parameter beyond (input_ids, scores) must be supplied via kwargs. If one is missing, it raises this ValueError because calling the processor would itself raise a TypeError, and the explicit message names the expected parameters.
Source
Thrown at ppocr/modeling/heads/rec_unimernet_head.py:1569
)
return attn_output, attn_output_weights
class LogitsProcessorList(list):
"""
A list of logits processors that can be applied sequentially.
Methods:
__call__(input_ids, scores, **kwargs): Apply all processors to the given inputs.
"""
def __call__(self, input_ids, scores, **kwargs):
for processor in self:
function_args = inspect.signature(processor.__call__).parameters
if len(function_args) > 2:
if not all(arg in kwargs for arg in list(function_args.keys())[2:]):
raise ValueError(
f"Make sure that all the required parameters: {list(function_args.keys())} for "
f"{processor.__class__} are passed to the logits processor."
)
scores = processor(input_ids, scores, **kwargs)
else:
scores = processor(input_ids, scores)
return scores
class ForcedEOSTokenLogitsProcessor(object):
"""
A processor that forces the generation of an end-of-sequence (EOS) token
at a specified position in the sequence.
This is typically used in language generation tasks to ensure that the
generated sequence ends properly when it reaches a certain length.
Args:View on GitHub (pinned to 2661c7c0ef)
Solutions
- Pass the missing kwarg(s) into the logits_processor call, e.g. logits_processor(input_ids, scores, min_length=cfg.min_length, eos_token_id=cfg.eos_token_id)
- Or remove the processor that requires unavailable arguments
- Wrap processor construction so required args are bound via functools.partial, reducing the signature to (input_ids, scores)
Example fix
# before
next_tokens_scores = self.logits_processor(input_ids, next_token_logits)
# after
next_tokens_scores = self.logits_processor(
input_ids, next_token_logits,
min_length=self.config.min_length,
eos_token_id=eos_token_id,
) Defensive patterns
Strategy: validation
Validate before calling
import inspect
required = [p for p in inspect.signature(processor.__call__).parameters][2:]
missing = [a for a in required if a not in generation_kwargs]
assert not missing, f'logits processor missing kwargs: {missing}' Try / catch
try:
scores = logits_processor(input_ids, scores, **gen_kwargs)
except ValueError as e:
if 'passed to the logits processor' in str(e):
gen_kwargs.update(min_length=cfg.min_length, eos_token_id=eos_id)
scores = logits_processor(input_ids, scores, **gen_kwargs)
else:
raise Prevention
- Bind processor-specific args with functools.partial at construction
- Keep a single gen_kwargs dict passed to every logits_processor call
When it happens
Trigger: Running generation with processors such as MinLengthLogitsProcessor (needs min_length) or ForcedEOSTokenLogitsProcessor (needs forced eos id) while the generate loop / custom loop does not pass those kwargs to logits_processor(input_ids, scores, **kwargs).
Common situations: Custom generate implementations (like the one in this head) that forward a fixed set of kwargs; adding a new processor to logits_processor list without updating the generation loop to supply its arguments.
Related errors
- `decoder_start_token_id` or `bos_token_id` has to be defined
- You have to specify either decoder_input_ids or decoder_inpu
- `decoder_start_token_id` expected to have length {batch_size
- If `eos_token_id` is defined, make sure that `pad_token_id`
- Please set inference model dir in Global.inference_model or
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/9410a28c75895dc2.
Report an issue: GitHub.