openvino_genai.ASRGenerationConfig#

class openvino_genai.ASRGenerationConfig#

Bases: GenerationConfig

Common parameters:

Parameters:
  • language (Optional[str]) – Language token to use for generation. In the form of <|en|> for Whisper models. Can be set for multilingual models only. In the form of English for Qwen3-ASR models.

  • return_timestamps (bool) – Whether to return segment-level timestamps.

Whisper parameters:

Parameters:
  • decoder_start_token_id (int) – Corresponds to the “<|startoftranscript|>” token.

  • pad_token_id (int) – Padding token id.

  • translate_token_id (int) – Translate token id.

  • transcribe_token_id (int) – Transcribe token id.

  • prev_sot_token_id (int) – Corresponds to the “<|startofprev|>” token.

  • no_timestamps_token_id (int) – No timestamps token id.

  • begin_suppress_tokens (list[int]) – A list containing tokens that will be suppressed at the beginning of the sampling process.

  • suppress_tokens (list[int]) – A list containing the non-speech tokens that will be suppressed during generation.

  • max_initial_timestamp_index (int) – Maximum initial timestamp index.

  • is_multilingual (bool) – Whether the model is multilingual.

  • task (Optional[str]) – Task to use for generation, either “translate” or “transcribe”. Can be set for multilingual models only.

  • lang_to_id (dict[str, int]) – Language token to token_id map. Initialized from the generation_config.json lang_to_id dictionary.

  • word_timestamps (bool) – If true the pipeline will return word-level timestamps. When enabled word_timestamps=True property should be passed to ASRPipeline constructor: ASRPipeline(“model_path”, “CPU”, word_timestamps=True)

  • alignment_heads (list[tuple[int, int]]) – Encoder attention alignment heads used for word-level timestamps prediction. Each pair represents (layer_index, head_index).

  • initial_prompt (Optional[str]) –

    Initial prompt tokens passed as a previous transcription (after <|startofprev|> token) to the first processing window. Can be used to steer the model to use particular spellings or styles.

    Example:

    result = pipeline.generate(raw_speech)
    #  He has gone and gone for good answered Paul Icrom who...
    
    result = pipeline.generate(raw_speech, initial_prompt="Polychrome")
    #  He has gone and gone for good answered Polychrome who...
    

  • hotwords (Optional[str]) –

    Hotwords tokens passed as a previous transcription (after <|startofprev|> token) to all processing windows. Can be used to steer the model to use particular spellings or styles.

    Example:

    result = pipeline.generate(raw_speech)
    #  He has gone and gone for good answered Paul Icrom who...
    
    result = pipeline.generate(raw_speech, hotwords="Polychrome")
    #  He has gone and gone for good answered Polychrome who...
    

Qwen3-ASR parameters:

Parameters:

context (Optional[str]) – System prompt context prepended to Qwen3-ASR transcription requests.

For generic generation parameters (max_length, max_new_tokens, num_beams, temperature, etc.) see GenerationConfig documentation.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.ASRGenerationConfig, json_path: os.PathLike | str | bytes) -> None

path where generation_config.json is stored

  1. __init__(self: openvino_genai.py_openvino_genai.ASRGenerationConfig, **kwargs) -> None

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__()

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(*args, **kwargs)

Overloaded function.

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_pybind11_conduit_v1_

is_assisting_generation(self)

is_beam_search(self)

is_greedy_decoding(self)

is_multinomial(self)

is_prompt_lookup(self)

is_tree_search(self)

set_eos_token_id(self, tokenizer_eos_token_id)

update_generation_config(self, **kwargs)

validate(self)

Attributes

__annotations__

adapters

alignment_heads

apply_chat_template

assistant_confidence_threshold

begin_suppress_tokens

branching_factor

Number of branches (top-k) at each level of the candidate tree

context

decoder_start_token_id

diversity_penalty

do_sample

echo

eos_token_id

frequency_penalty

hotwords

ignore_eos

include_stop_str_in_output

initial_prompt

is_multilingual

lang_to_id

language

length_penalty

logprobs

max_initial_timestamp_index

max_length

max_new_tokens

max_ngram_size

min_new_tokens

min_p

no_repeat_ngram_size

no_timestamps_token_id

num_assistant_tokens

num_beam_groups

num_beams

num_return_sequences

pad_token_id

parsers

presence_penalty

prev_sot_token_id

pruning_ratio

relevance_weight

repetition_penalty

return_omni_outputs

return_timestamps

rng_seed

stop_criteria

stop_strings

stop_token_ids

structured_output_config

suppress_tokens

task

temperature

top_k

top_p

transcribe_token_id

translate_token_id

tree_depth

Lookahead depth of the candidate tree

word_timestamps

__annotations__ = {}#
__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(value, /)#

Return self==value.

__format__(format_spec, /)#

Default object formatter.

Return str(self) if format_spec is empty. Raise TypeError otherwise.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__getstate__()#

Helper for pickle.

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.ASRGenerationConfig, json_path: os.PathLike | str | bytes) -> None

path where generation_config.json is stored

  1. __init__(self: openvino_genai.py_openvino_genai.ASRGenerationConfig, **kwargs) -> None

__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__ne__(value, /)#

Return self!=value.

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

__sizeof__()#

Size of object in memory, in bytes.

__str__()#

Return str(self).

__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

_pybind11_conduit_v1_()#
property adapters#
property alignment_heads#
property apply_chat_template#
property assistant_confidence_threshold#
property begin_suppress_tokens#
property branching_factor#

Number of branches (top-k) at each level of the candidate tree

property context#
property decoder_start_token_id#
property diversity_penalty#
property do_sample#
property echo#
property eos_token_id#
property frequency_penalty#
property hotwords#
property ignore_eos#
property include_stop_str_in_output#
property initial_prompt#
is_assisting_generation(self: openvino_genai.py_openvino_genai.GenerationConfig) bool#
is_greedy_decoding(self: openvino_genai.py_openvino_genai.GenerationConfig) bool#
property is_multilingual#
is_multinomial(self: openvino_genai.py_openvino_genai.GenerationConfig) bool#
is_prompt_lookup(self: openvino_genai.py_openvino_genai.GenerationConfig) bool#
property lang_to_id#
property language#
property length_penalty#
property logprobs#
property max_initial_timestamp_index#
property max_length#
property max_new_tokens#
property max_ngram_size#
property min_new_tokens#
property min_p#
property no_repeat_ngram_size#
property no_timestamps_token_id#
property num_assistant_tokens#
property num_beam_groups#
property num_beams#
property num_return_sequences#
property pad_token_id#
property parsers#
property presence_penalty#
property prev_sot_token_id#
property pruning_ratio#
property relevance_weight#
property repetition_penalty#
property return_omni_outputs#
property return_timestamps#
property rng_seed#
set_eos_token_id(self: openvino_genai.py_openvino_genai.GenerationConfig, tokenizer_eos_token_id: SupportsInt) None#
property stop_criteria#
property stop_strings#
property stop_token_ids#
property structured_output_config#
property suppress_tokens#
property task#
property temperature#
property top_k#
property top_p#
property transcribe_token_id#
property translate_token_id#
property tree_depth#

Lookahead depth of the candidate tree

update_generation_config(self: openvino_genai.py_openvino_genai.ASRGenerationConfig, **kwargs) None#
validate(self: openvino_genai.py_openvino_genai.GenerationConfig) None#
property word_timestamps#