{"record":{"id":"9733abd276f5446e","repo":"huggingface/transformers","slug":"forced-decoder-ids-is-deprecated-in-favor-of-ta","errorCode":null,"errorMessage":"`forced_decoder_ids` is deprecated in favor of `task` and `language` and, as such, `begin_index` must be provided to `WhisperTimeStampLogitsProcessor`. The previous default value of `begin_index` was `len(generate_config.forced_decoder_ids)`","messagePattern":"`forced_decoder_ids` is deprecated in favor of `task` and `language` and, as such, `begin_index` must be provided to `WhisperTimeStampLogitsProcessor`\\. The previous default value of `begin_index` was `len\\(generate_config\\.forced_decoder_ids\\)`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/generation/logits_process.py","lineNumber":1986,"sourceCode":"        self,\n        generate_config: \"GenerationConfig\",\n        begin_index: int,\n        _detect_timestamp_from_logprob: bool | None = None,\n    ):  # support for the kwargs\n        whisper_generate_config = cast(WhisperGenerationConfigLike, generate_config)\n        self.no_timestamps_token_id = whisper_generate_config.no_timestamps_token_id\n        self.timestamp_begin = whisper_generate_config.no_timestamps_token_id + 1\n        self.eos_token_id = generate_config.eos_token_id or generate_config.bos_token_id\n\n        # this variable is mostly just used for testing\n        self._detect_timestamp_from_logprob = (\n            _detect_timestamp_from_logprob\n            if _detect_timestamp_from_logprob is not None\n            else getattr(generate_config, \"_detect_timestamp_from_logprob\", True)\n        )\n        self.begin_index = begin_index\n        if begin_index is None:\n            raise ValueError(\n                \"`forced_decoder_ids` is deprecated in favor of `task` and `language` and, as such, `begin_index` \"\n                \"must be provided to `WhisperTimeStampLogitsProcessor`. The previous default value of `begin_index` \"\n                \"was `len(generate_config.forced_decoder_ids)`\"\n            )\n\n        self.max_initial_timestamp_index = getattr(generate_config, \"max_initial_timestamp_index\", None)\n        # TODO(Patrick): Make sure that official models have max_initial_timestamp_index set to 50\n        # self.max_initial_timestamp_index = 50\n\n    def set_begin_index(self, begin_index):\n        self.begin_index = begin_index\n\n    @add_start_docstrings(LOGITS_PROCESSOR_INPUTS_DOCSTRING)\n    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:\n        # suppress <|notimestamps|> which is handled by without_timestamps\n        scores_processed = scores.clone()\n        scores_processed[:, self.no_timestamps_token_id] = -float(\"inf\")\n","sourceCodeStart":1968,"sourceCodeEnd":2004,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/generation/logits_process.py#L1968-L2004","documentation":"Error \"`forced_decoder_ids` is deprecated in favor of `task` and `language` and, as such, `begin_index` must be provided to `WhisperTimeStampLogitsProcessor`. The previous default value of `begin_index` was `len(generate_config.forced_decoder_ids)`\" thrown in huggingface/transformers.","triggerScenarios":"Raised in WhisperTimeStampLogitsProcessor.__init__ when begin_index is not provided because the deprecated forced_decoder_ids path was used.","commonSituations":"Whisper timestamp generation where begin_index defaults are missing after removing forced_decoder_ids in favor of task/language arguments.","solutions":["Provide `begin_index` explicitly to `WhisperTimeStampLogitsProcessor`.","Migrate to `task`/`language` generation arguments instead of `forced_decoder_ids`."],"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"}