Skip to content

Commit

Permalink
Add support for distil whisper (#1245)
Browse files Browse the repository at this point in the history
* Add support for distil-whisper.

* Add distil-large.

* Rename the large model.
  • Loading branch information
LaurentMazare authored Nov 2, 2023
1 parent d39d0c4 commit e08fbb6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions candle-examples/examples/whisper/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,25 @@ enum WhichModel {
MediumEn,
Large,
LargeV2,
#[value(name = "distil-medium.en")]
DistilMediumEn,
#[value(name = "distil-large-v2")]
DistilLargeV2,
}

impl WhichModel {
fn is_multilingual(&self) -> bool {
match self {
Self::Tiny | Self::Base | Self::Small | Self::Medium | Self::Large | Self::LargeV2 => {
true
Self::Tiny
| Self::Base
| Self::Small
| Self::Medium
| Self::Large
| Self::LargeV2
| Self::DistilLargeV2 => true,
Self::TinyEn | Self::BaseEn | Self::SmallEn | Self::MediumEn | Self::DistilMediumEn => {
false
}
Self::TinyEn | Self::BaseEn | Self::SmallEn | Self::MediumEn => false,
}
}

Expand All @@ -385,6 +395,8 @@ impl WhichModel {
Self::MediumEn => ("openai/whisper-medium.en", "main"),
Self::Large => ("openai/whisper-large", "refs/pr/36"),
Self::LargeV2 => ("openai/whisper-large-v2", "refs/pr/57"),
Self::DistilMediumEn => ("distil-whisper/distil-medium.en", "main"),
Self::DistilLargeV2 => ("distil-whisper/distil-large-v2", "main"),
}
}
}
Expand Down

0 comments on commit e08fbb6

Please sign in to comment.