{"record":{"id":"47031dfa9cc69558","repo":"huggingface/transformers","slug":"each-element-in-sequence-bias-has-to-be-a-non-em","errorCode":null,"errorMessage":"Each element in `sequence_bias` has to be a non-empty list of lists of positive integers and float, but is {sequence_bias}.","messagePattern":"Each element in `sequence_bias` has to be a non-empty list of lists of positive integers and float, but is (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/generation/logits_process.py","lineNumber":1381,"sourceCode":"            or len(sequence_ids) == 0\n            for sequence_ids in sequence_bias\n        ):\n            raise ValueError(\n                f\"Each key in `sequence_bias` has to be a non-empty tuple of positive integers, but is \"\n                f\"{sequence_bias}.\"\n            )\n\n        def all_token_bias_pairs_are_valid(sequence):\n            return (\n                isinstance(sequence[0], list)\n                and all(isinstance(token_id, (int, np.integer)) and token_id > 0 for token_id in sequence[0])\n                and isinstance(sequence[1], float)\n            )\n\n        if isinstance(sequence_bias, list) and any(\n            (not all_token_bias_pairs_are_valid(sequence)) or len(sequence) == 0 for sequence in sequence_bias\n        ):\n            raise ValueError(\n                f\"Each element in `sequence_bias` has to be a non-empty list of lists of positive integers and float, but is \"\n                f\"{sequence_bias}.\"\n            )\n        if isinstance(sequence_bias, dict) and any(not isinstance(bias, float) for bias in sequence_bias.values()):\n            raise ValueError(f\"`sequence_bias` has to be a dict with floats as values, but is {sequence_bias}.\")\n\n    def _convert_list_arguments_into_dict(self):\n        \"\"\"BC: we used to accept `dict{tuple of tokens: float}` directly, now we expect a list\"\"\"\n        if isinstance(self.sequence_bias, list):\n            temp_sequence = self.sequence_bias\n            self.sequence_bias = {tuple(sublist[0]): sublist[1] for sublist in temp_sequence}\n\n\nclass NoBadWordsLogitsProcessor(SequenceBiasLogitsProcessor):\n    \"\"\"\n    [`LogitsProcessor`] that enforces that specified sequences will never be selected.\n\n    <Tip>","sourceCodeStart":1363,"sourceCodeEnd":1399,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/generation/logits_process.py#L1363-L1399","documentation":"Error \"Each element in `sequence_bias` has to be a non-empty list of lists of positive integers and float, but is {sequence_bias}.\" thrown in huggingface/transformers.","triggerScenarios":"Raised in SequenceBiasLogitsProcessor.__init__ when the list-of-lists form of sequence_bias contains entries that are not a [token_ids_list, bias] pair of valid types.","commonSituations":"Using the list form of sequence_bias with malformed inner lists, non-integer token ids, or a non-float bias value.","solutions":["Pass `sequence_bias` as a non-empty list of [token_ids, bias] pairs where token_ids is a list of positive integers and bias is a float.","Alternatively use the dict form: {(token_id, ...): float_bias}."],"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-15T22:17:37.221Z"}