Skip to content

whisper-large-v3 compatibility - #1530

Merged
vince62s merged 6 commits into
OpenNMT:masterfrom
funboarder13920:n_mels_param
Nov 8, 2023
Merged

vince62s merged 6 commits into
OpenNMT:masterfrom
funboarder13920:n_mels_param

Conversation

@funboarder13920

@funboarder13920 funboarder13920 commented Nov 7, 2023 •

Copy link
Copy Markdown
Contributor

openai whisper large-v3 introduces change from 80 to 128 in mel input feature.
exposing n_mels is required to propagate the input size to the audio feature extractor

we also need to add the large-v3 alignment heads
a fix is required in the computation of _is_multilingual

openai whisper large-v3 introduces change from 80 to 128 in mel input feature.
exposing n_mels is required to propagate the input size to the audio feature extractor
@chiiyeh

chiiyeh commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

Hi could you also add to here: https://github.com/OpenNMT/CTranslate2/blob/master/python/ctranslate2/converters/transformers.py#L1929-L2042

    "openai/whisper-large-v3": [
        (7, 0),
        (10, 17),
        (12, 18),
        (13, 12),
        (16, 1),
        (17, 14),
        (19, 11),
        (21, 4),
        (24, 1),
        (25, 6),
    ],

obtained from here: https://github.com/openai/whisper/blob/fcfeaf1b61994c071bba62da47d7846933576ac9/whisper/__init__.py#L45

funboarder13920 added a commit to funboarder13920/CTranslate2 that referenced this pull request Nov 8, 2023
@funboarder13920 funboarder13920 changed the title expose n_mels whisper-large-v3 compatibility Nov 8, 2023
funboarder13920 added a commit to funboarder13920/CTranslate2 that referenced this pull request Nov 8, 2023
@RafaRed

RafaRed commented Nov 8, 2023 •

Copy link
Copy Markdown

The current check for multilingual support seems to be hardcoded with a specific vocabulary size:
_is_multilingual = vocabulary.size() == 51865;
Link to code

For instance, I believe the whisper-latest-v3 model has a vocabulary size of 51866, which is one more than the hardcoded value. This discrepancy could lead to the multilingual feature being incorrectly disabled for this model.

Probably a more dynamic check need to be implemented to ensure compatibility with future models.

edit: oh sorry, did not notice its already fixed on PR.

@funboarder13920

funboarder13920 commented Nov 8, 2023 •

Copy link
Copy Markdown
Contributor Author

The current check for multilingual support seems to be hardcoded with a specific vocabulary size: _is_multilingual = vocabulary.size() == 51865; Link to code

For instance, I believe the whisper-latest-v3 model has a vocabulary size of 51866, which is one more than the hardcoded value. This discrepancy could lead to the multilingual feature being incorrectly disabled for this model.

Probably a more dynamic check need to be implemented to ensure compatibility with future models.

A fix is already in this PR :

_is_multilingual = vocabulary.size() >= 51865;

@Purfview

Purfview commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

@vince62s Can you merge this?

(26, 12),
(27, 15),
],
"openai/whisper-large-v3": [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible worth adding a comment on the source of these since its different from the source on L1928.

@vince62s
vince62s merged commit 23f744f into OpenNMT:master Nov 8, 2023
Lanurence666 pushed a commit to Lanurence666/CTranslate2_backport_py38 that referenced this pull request May 23, 2026
* expose n_mels
openai whisper large-v3 introduces change from 80 to 128 in mel input feature.
exposing n_mels is required to propagate the input size to the audio feature extractor
* fix guessing is_multilingual for large-v3
* alignement heads for large-v3
see OpenNMT#1530 (comment)
* add num_languages property to whisper models
* update comment documentation
---------

Co-authored-by: Valentin Berkes <vberkes@ubiqus.com>
veilnetwork pushed a commit to veilnetwork/CTranslate2 that referenced this pull request Aug 27, 2026
* expose n_mels
openai whisper large-v3 introduces change from 80 to 128 in mel input feature.
exposing n_mels is required to propagate the input size to the audio feature extractor
* fix guessing is_multilingual for large-v3
* alignement heads for large-v3
see OpenNMT#1530 (comment)
* add num_languages property to whisper models
* update comment documentation
---------

Co-authored-by: Valentin Berkes <vberkes@ubiqus.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants