{"record":{"id":"00461c811aa6c5f1","repo":"huggingface/transformers","slug":"input-starting-length-has-to-be-a-non-negative-i","errorCode":null,"errorMessage":"`input_starting_length` has to be a non-negative integer, but is {input_start_len}","messagePattern":"`input_starting_length` has to be a non-negative integer, but is (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/generation/logits_process.py","lineNumber":2202,"sourceCode":"\n    This logits processor is exclusively compatible with\n    [Bark](https://huggingface.co/docs/transformers/en/model_doc/bark)'s fine submodel. See the model documentation\n    for examples.\n\n    </Tip>\n\n    Args:\n        input_start_len (`int`):\n            The length of the initial input sequence.\n        semantic_vocab_size (`int`):\n            Vocabulary size of the semantic part, i.e number of tokens associated to the semantic vocabulary.\n        codebook_size (`int`):\n            Number of tokens associated to the codebook.\n    \"\"\"\n\n    def __init__(self, input_start_len: int, semantic_vocab_size: int, codebook_size: int):\n        if not isinstance(input_start_len, int) or input_start_len < 0:\n            raise ValueError(f\"`input_starting_length` has to be a non-negative integer, but is {input_start_len}\")\n\n        self.input_start_len = input_start_len\n        self.semantic_vocab_size = semantic_vocab_size\n        self.codebook_size = codebook_size\n\n    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:\n        curr_len = input_ids.shape[-1]\n\n        # even -> first codebook, odd -> second codebook\n        is_first_codebook = ((curr_len - self.input_start_len) % 2) == 0\n\n        scores_processed = scores.clone()\n        if is_first_codebook:\n            scores_processed[:, : self.semantic_vocab_size] = -float(\"inf\")\n            scores_processed[:, self.semantic_vocab_size + self.codebook_size :] = -float(\"inf\")\n        else:\n            scores_processed[:, : self.semantic_vocab_size + self.codebook_size] = -float(\"inf\")\n","sourceCodeStart":2184,"sourceCodeEnd":2220,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/generation/logits_process.py#L2184-L2220","documentation":"Error \"`input_starting_length` has to be a non-negative integer, but is {input_start_len}\" thrown in huggingface/transformers.","triggerScenarios":"Raised in ClassifierFreeGuidanceLogitsProcessor.__init__ when input_starting_length (or input_start_len) is negative or not an integer.","commonSituations":"Misconfigured CFG processor construction with a negative input_starting_length value.","solutions":["Pass a non-negative integer for `input_starting_length`.","Use `input_ids.shape[-1]` for the actual prompt length."],"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"}