huggingface/transformers · 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 signature: if __call__ takes more than input_ids/scores, every extra parameter must be present in kwargs. This error fires when a processor needing extra arguments is invoked through a path that did not supply them (e.g. manual list invocation instead of full generate).
Source
Thrown at src/transformers/generation/logits_process.py:90
Args:
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
Indices of input sequence tokens in the vocabulary. [What are input IDs?](../glossary#input-ids)
scores (`torch.FloatTensor` of shape `(batch_size, config.vocab_size)`):
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using
beam search or log softmax for each vocabulary token when using beam search
kwargs (`dict[str, Any]`, *optional*):
Additional kwargs that are specific to a logits processor.
Return:
`torch.FloatTensor` of shape `(batch_size, config.vocab_size)`:
The processed prediction scores.
"""
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 MinLengthLogitsProcessor(LogitsProcessor):
r"""
[`LogitsProcessor`] enforcing a min-length by setting EOS probability to 0. Note that, for decoder-only models
like most LLMs, the length includes the prompt.
Args:
min_length (`int`):
The minimum length below which the score of `eos_token_id` is set to `-float("Inf")`.View on GitHub (pinned to a597f97485)
Solutions
- Pass the missing kwargs: processors(input_ids, scores, **{'attention_mask': am, ...}) — the error lists the required names
- Or route through model.generate, which supplies all standard kwargs
- In custom processors, give extra params defaults so len(signature)<=2 logic or kwargs both work
Example fix
# before scores = processors(input_ids, scores) # processor needs attention_mask # after scores = processors(input_ids, scores, attention_mask=attention_mask)
Defensive patterns
Strategy: validation
Validate before calling
import inspect
required = [p for proc in processors for p in list(inspect.signature(proc.__call__).parameters)[2:]]
missing = [p for p in set(required) if p not in my_kwargs]
assert not missing, f'missing processor kwargs: {missing}'
scores = processors(input_ids, scores, **my_kwargs) Try / catch
try:
scores = processors(input_ids, scores, **kwargs)
except ValueError as e:
if 'passed to the logits processor' in str(e):
kwargs.setdefault('attention_mask', attention_mask) # add commonly missing kwarg
scores = processors(input_ids, scores, **kwargs)
else:
raise Prevention
- Route through model.generate when possible
- Give custom processors' extra params defaults
- Keep kwargs dicts complete when hand-driving decode loops
When it happens
Trigger: processors(input_ids, scores) called manually while the list contains e.g. SuppressTokensLogitsProcessor-like processors with extra params, or a custom processor with __call__(self, input_ids, scores, attention_mask) invoked without attention_mask in kwargs.
Common situations: Reusing a LogitsProcessorList built for model.generate in custom decoding loops; processors added by stopping-criteria machinery that expect generate-managed kwargs; signature changes across versions adding new params.
Related errors
- {self.__class__} is an abstract class. Only classes inheriti
- Cannot assign to field {name}, you should create a new insta
- Framework '{return_tensors}' not recognized!
- return_tensors should be `'pt'` or `None`
- Can only set a dictionary as `tp_plan`
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/233481b4ec45443f.
Report an issue: GitHub.