{"record":{"id":"82d6b66ee99d1f1c","repo":"2noise/ChatTTS","slug":"penalty-has-to-be-a-strictly-positive-float-but","errorCode":null,"errorMessage":"`penalty` has to be a strictly positive float, but is {penalty}","messagePattern":"`penalty` has to be a strictly positive float, but is (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ChatTTS/model/processors.py","lineNumber":10,"sourceCode":"import torch\nimport torch.nn.functional as F\nfrom transformers.generation import TopKLogitsWarper, TopPLogitsWarper\n\n\nclass CustomRepetitionPenaltyLogitsProcessorRepeat:\n\n    def __init__(self, penalty: float, max_input_ids: int, past_window: int):\n        if not isinstance(penalty, float) or not (penalty > 0):\n            raise ValueError(\n                f\"`penalty` has to be a strictly positive float, but is {penalty}\"\n            )\n\n        self.penalty = penalty\n        self.max_input_ids = max_input_ids\n        self.past_window = past_window\n\n    def __call__(\n        self, input_ids: torch.LongTensor, scores: torch.FloatTensor\n    ) -> torch.FloatTensor:\n        if input_ids.size(1) > self.past_window:\n            input_ids = input_ids.narrow(1, -self.past_window, self.past_window)\n        freq = F.one_hot(input_ids, scores.size(1)).sum(1)\n        if freq.size(0) > self.max_input_ids:\n            freq.narrow(\n                0, self.max_input_ids, freq.size(0) - self.max_input_ids\n            ).zero_()\n        alpha = torch.pow(self.penalty, freq)","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/2noise/ChatTTS/blob/77b89ee281cd479f5b1a787ada330dc975ca1f2a/ChatTTS/model/processors.py#L1-L28","documentation":"Error \"`penalty` has to be a strictly positive float, but is {penalty}\" thrown in 2noise/ChatTTS.","triggerScenarios":"Thrown at ChatTTS/model/processors.py:10 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b89ee281cd479f5b1a787ada330dc975ca1f2a","analyzedAt":"2026-08-26T17:48:24.233Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}