openvino_genai.WhisperGenerationConfig#

class openvino_genai.WhisperGenerationConfig#

Bases: pybind11_object

Parameters:
  • max_length (int) – the maximum length the generated tokens can have. Corresponds to the length of the input prompt + max_new_tokens. Its effect is overridden by max_new_tokens, if also set.

  • max_new_tokens (int) – the maximum numbers of tokens to generate, excluding the number of tokens in the prompt. max_new_tokens has priority over max_length.

  • eos_token_id (int) – End of stream token id.

Whisper specific 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.

  • no_timestamps_token_id (int) – No timestamps token id.

  • is_multilingual (bool)

  • 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.

  • language (Optional[str]) – Language token to use for generation in the form of <|en|>. You can find all the possible language tokens in the generation_config.json lang_to_id dictionary.

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

  • task (int) – Task to use for generation, either “translate” or “transcribe”

  • return_timestamps (bool) –

    If true the pipeline will return timestamps along the text for segments of words in the text. For instance, if you get WhisperDecodedResultChunk

    start_ts = 0.5 end_ts = 1.5 text = “ Hi there!”

    then it means the model predicts that the segment “Hi there!” was spoken after 0.5 and before 1.5 seconds. Note that a segment of text refers to a sequence of one or more words, rather than individual words.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.WhisperGenerationConfig, json_path: os.PathLike) -> None

path where generation_config.json is stored

  1. __init__(self: openvino_genai.py_openvino_genai.WhisperGenerationConfig, **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).

__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().

set_eos_token_id(self, tokenizer_eos_token_id)

Attributes

begin_suppress_tokens

decoder_start_token_id

eos_token_id

is_multilingual

lang_to_id

language

max_initial_timestamp_index

max_length

max_new_tokens

no_timestamps_token_id

pad_token_id

return_timestamps

suppress_tokens

task

transcribe_token_id

translate_token_id

__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.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.WhisperGenerationConfig, json_path: os.PathLike) -> None

path where generation_config.json is stored

  1. __init__(self: openvino_genai.py_openvino_genai.WhisperGenerationConfig, **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).

property begin_suppress_tokens#
property decoder_start_token_id#
property eos_token_id#
property is_multilingual#
property lang_to_id#
property language#
property max_initial_timestamp_index#
property max_length#
property max_new_tokens#
property no_timestamps_token_id#
property pad_token_id#
property return_timestamps#
set_eos_token_id(self: openvino_genai.py_openvino_genai.WhisperGenerationConfig, tokenizer_eos_token_id: int) None#
property suppress_tokens#
property task#
property transcribe_token_id#
property translate_token_id#