{"record":{"id":"c2a670f7144b4e5a","repo":"huggingface/transformers","slug":"min-eos-p-has-to-be-a-positive-float-but-is-mi","errorCode":null,"errorMessage":"`min_eos_p` has to be a positive float, but is {min_eos_p}","messagePattern":"`min_eos_p` has to be a positive float, but is (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/generation/logits_process.py","lineNumber":2370,"sourceCode":"    Args:\n        eos_token_id (`Union[int, list[int], torch.Tensor]`):\n            The id(s) of the *end-of-sequence* token.\n        min_eos_p (`float`, *optional*):\n            Minimum end of speech threshold.\n    \"\"\"\n\n    def __init__(self, eos_token_id: int | list[int] | torch.Tensor, min_eos_p: float, device: str = \"cpu\"):\n        if not isinstance(eos_token_id, torch.Tensor):\n            if isinstance(eos_token_id, int):\n                eos_token_id = [eos_token_id]\n            eos_token_id = torch.tensor(eos_token_id, device=device)\n        self.eos_token_id = eos_token_id\n\n        if torch.is_floating_point(eos_token_id) or (eos_token_id < 0).any():\n            raise ValueError(f\"`eos_token_id` has to be a list of positive integers, but is {eos_token_id}\")\n\n        if min_eos_p is not None and min_eos_p <= 0:\n            raise ValueError(f\"`min_eos_p` has to be a positive float, but is {min_eos_p}\")\n        self.min_eos_p = min_eos_p\n\n    @add_start_docstrings(LOGITS_PROCESSOR_INPUTS_DOCSTRING)\n    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:\n        scores_processed = scores\n        if self.min_eos_p:\n            probs = torch.nn.functional.softmax(scores.float(), dim=-1)\n            # create scores full of -inf except for the eos_token_id\n            early_stop_scores = torch.ones_like(scores) * -float(\"inf\")\n            early_stop_scores[:, self.eos_token_id] = scores[:, self.eos_token_id]\n\n            do_early_stop = probs[:, self.eos_token_id] > self.min_eos_p\n            do_early_stop = torch.any(do_early_stop, dim=1, keepdim=True)\n            scores_processed = torch.where(do_early_stop, early_stop_scores, scores)\n\n        return scores_processed\n\n","sourceCodeStart":2352,"sourceCodeEnd":2388,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/generation/logits_process.py#L2352-L2388","documentation":"Error \"`min_eos_p` has to be a positive float, but is {min_eos_p}\" thrown in huggingface/transformers.","triggerScenarios":"Raised in MinEosProbabilityLogitsProcessor (or equivalent early-stop processor) when min_eos_p is not a positive float.","commonSituations":"Setting min_eos_p to 0, a negative number, or a non-float when configuring early stopping on EOS probability.","solutions":["Set `min_eos_p` to a positive float (e.g. 0.1).","Remove `min_eos_p` if you do not want probability-based early stopping."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}