huggingface/transformers · error · ValueError
`forced_decoder_ids` is deprecated in favor of `task` and `l
Error message
`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)`
What it means
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.
Source
Thrown at src/transformers/generation/logits_process.py:1986
self,
generate_config: "GenerationConfig",
begin_index: int,
_detect_timestamp_from_logprob: bool | None = None,
): # support for the kwargs
whisper_generate_config = cast(WhisperGenerationConfigLike, generate_config)
self.no_timestamps_token_id = whisper_generate_config.no_timestamps_token_id
self.timestamp_begin = whisper_generate_config.no_timestamps_token_id + 1
self.eos_token_id = generate_config.eos_token_id or generate_config.bos_token_id
# this variable is mostly just used for testing
self._detect_timestamp_from_logprob = (
_detect_timestamp_from_logprob
if _detect_timestamp_from_logprob is not None
else getattr(generate_config, "_detect_timestamp_from_logprob", True)
)
self.begin_index = begin_index
if begin_index is None:
raise ValueError(
"`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)`"
)
self.max_initial_timestamp_index = getattr(generate_config, "max_initial_timestamp_index", None)
# TODO(Patrick): Make sure that official models have max_initial_timestamp_index set to 50
# self.max_initial_timestamp_index = 50
def set_begin_index(self, begin_index):
self.begin_index = begin_index
@add_start_docstrings(LOGITS_PROCESSOR_INPUTS_DOCSTRING)
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
# suppress <|notimestamps|> which is handled by without_timestamps
scores_processed = scores.clone()
scores_processed[:, self.no_timestamps_token_id] = -float("inf")
View on GitHub (pinned to a597f97485)
Solutions
- Provide `begin_index` explicitly to `WhisperTimeStampLogitsProcessor`.
- Migrate to `task`/`language` generation arguments instead of `forced_decoder_ids`.
When it happens
Trigger: Raised in WhisperTimeStampLogitsProcessor.__init__ when begin_index is not provided because the deprecated forced_decoder_ids path was used.
Common situations: Whisper timestamp generation where begin_index defaults are missing after removing forced_decoder_ids in favor of task/language arguments.
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/9733abd276f5446e.
Report an issue: GitHub.