{"record":{"id":"3f61585150c46a1f","repo":"2noise/ChatTTS","slug":"min-p-must-be-in-0-1-got-self-min-p","errorCode":null,"errorMessage":"min_p must be in [0, 1], got {self.min_p}.","messagePattern":"min_p must be in \\[0, 1\\], got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ChatTTS/model/velocity/sampling_params.py","lineNumber":212,"sourceCode":"                \"frequency_penalty must be in [-2, 2], got \"\n                f\"{self.frequency_penalty}.\"\n            )\n        if not 0.0 < self.repetition_penalty <= 2.0:\n            raise ValueError(\n                \"repetition_penalty must be in (0, 2], got \"\n                f\"{self.repetition_penalty}.\"\n            )\n        # if self.temperature < 0.0:\n        #     raise ValueError(\n        #         f\"temperature must be non-negative, got {self.temperature}.\")\n        if not 0.0 < self.top_p <= 1.0:\n            raise ValueError(f\"top_p must be in (0, 1], got {self.top_p}.\")\n        if self.top_k < -1 or self.top_k == 0:\n            raise ValueError(\n                f\"top_k must be -1 (disable), or at least 1, \" f\"got {self.top_k}.\"\n            )\n        if not 0.0 <= self.min_p <= 1.0:\n            raise ValueError(\"min_p must be in [0, 1], got \" f\"{self.min_p}.\")\n        if self.max_tokens < 1:\n            raise ValueError(f\"max_tokens must be at least 1, got {self.max_tokens}.\")\n        if self.logprobs is not None and self.logprobs < 0:\n            raise ValueError(f\"logprobs must be non-negative, got {self.logprobs}.\")\n        if self.prompt_logprobs is not None and self.prompt_logprobs < 0:\n            raise ValueError(\n                f\"prompt_logprobs must be non-negative, got \" f\"{self.prompt_logprobs}.\"\n            )\n\n    def _verify_beam_search(self) -> None:\n        if self.best_of == 1:\n            raise ValueError(\n                \"best_of must be greater than 1 when using beam \"\n                f\"search. Got {self.best_of}.\"\n            )\n        if self.temperature > _SAMPLING_EPS:\n            raise ValueError(\"temperature must be 0 when using beam search.\")\n        if self.top_p < 1.0 - _SAMPLING_EPS:","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/2noise/ChatTTS/blob/77b89ee281cd479f5b1a787ada330dc975ca1f2a/ChatTTS/model/velocity/sampling_params.py#L194-L230","documentation":"SamplingParams._verify_args enforces min_p in the inclusive range [0, 1]. min_p filters tokens whose probability is below min_p times the probability of the most likely token, so it is a ratio and must lie in [0, 1].","triggerScenarios":"Constructing SamplingParams with min_p < 0 or min_p > 1.0 (e.g. 1.2 or -0.1 from user input).","commonSituations":"Confusing min_p with an absolute probability threshold; unvalidated request payloads; porting a min_p value tuned against another implementation.","solutions":["Keep min_p in [0, 1]; 0 disables min_p filtering","Clamp or validate the value before constructing SamplingParams"],"exampleFix":"# before\nparams = SamplingParams(min_p=1.2)\n\n# after\nparams = SamplingParams(min_p=0.05)","handlingStrategy":"validation","validationCode":"def clamp_min_p(v: float) -> float:\n    return min(max(float(v), 0.0), 1.0)","typeGuard":"def is_valid_min_p(v) -> bool:\n    return isinstance(v, (int, float)) and 0.0 <= v <= 1.0","tryCatchPattern":null,"preventionTips":["Clamp min_p to [0, 1] at the request boundary","Remember 0 disables min-p filtering"],"tags":["sampling-params","validation","min-p","llm-generation"],"backgroundTag":"invalid-sampling-parameter","analyzedSha":"77b89ee281cd479f5b1a787ada330dc975ca1f2a","analyzedAt":"2026-08-26T17:48:24.233Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}