{"record":{"id":"233481b4ec45443f","repo":"huggingface/transformers","slug":"make-sure-that-all-the-required-parameters-list","errorCode":null,"errorMessage":"Make sure that all the required parameters: {list(function_args.keys())} for {processor.__class__} are passed to the logits processor.","messagePattern":"Make sure that all the required parameters: (.+?) for (.+?) are passed to the logits processor\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/generation/logits_process.py","lineNumber":90,"sourceCode":"        Args:\n            input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):\n                Indices of input sequence tokens in the vocabulary. [What are input IDs?](../glossary#input-ids)\n            scores (`torch.FloatTensor` of shape `(batch_size, config.vocab_size)`):\n                Prediction scores of a language modeling head. These can be logits for each vocabulary when not using\n                beam search or log softmax for each vocabulary token when using beam search\n            kwargs (`dict[str, Any]`, *optional*):\n                Additional kwargs that are specific to a logits processor.\n\n        Return:\n            `torch.FloatTensor` of shape `(batch_size, config.vocab_size)`:\n                The processed prediction scores.\n\n        \"\"\"\n        for processor in self:\n            function_args = inspect.signature(processor.__call__).parameters\n            if len(function_args) > 2:\n                if not all(arg in kwargs for arg in list(function_args.keys())[2:]):\n                    raise ValueError(\n                        f\"Make sure that all the required parameters: {list(function_args.keys())} for \"\n                        f\"{processor.__class__} are passed to the logits processor.\"\n                    )\n                scores = processor(input_ids, scores, **kwargs)\n            else:\n                scores = processor(input_ids, scores)\n\n        return scores\n\n\nclass MinLengthLogitsProcessor(LogitsProcessor):\n    r\"\"\"\n    [`LogitsProcessor`] enforcing a min-length by setting EOS probability to 0. Note that, for decoder-only models\n    like most LLMs, the length includes the prompt.\n\n    Args:\n        min_length (`int`):\n            The minimum length below which the score of `eos_token_id` is set to `-float(\"Inf\")`.","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/generation/logits_process.py#L72-L108","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nscores = processors(input_ids, scores)  # processor needs attention_mask\n\n# after\nscores = processors(input_ids, scores, attention_mask=attention_mask)","handlingStrategy":"validation","validationCode":"import inspect\nrequired = [p for proc in processors for p in list(inspect.signature(proc.__call__).parameters)[2:]]\nmissing = [p for p in set(required) if p not in my_kwargs]\nassert not missing, f'missing processor kwargs: {missing}'\nscores = processors(input_ids, scores, **my_kwargs)","typeGuard":null,"tryCatchPattern":"try:\n    scores = processors(input_ids, scores, **kwargs)\nexcept ValueError as e:\n    if 'passed to the logits processor' in str(e):\n        kwargs.setdefault('attention_mask', attention_mask)  # add commonly missing kwarg\n        scores = processors(input_ids, scores, **kwargs)\n    else:\n        raise","preventionTips":["Route through model.generate when possible","Give custom processors' extra params defaults","Keep kwargs dicts complete when hand-driving decode loops"],"tags":["logits-processor","kwargs","introspection","api-misuse"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}