Skip to content

Commit 290bf57

Browse files
committed
add new models
1 parent 4b5c6a2 commit 290bf57

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

DESCRIPTION

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ Suggests:
2929
audio.vadwebrtc (>= 0.2.0)
3030
LinkingTo: Rcpp
3131
SystemRequirements: GNU make
32-
RoxygenNote: 7.1.2
32+
RoxygenNote: 7.3.2
3333
Remotes: bnosac/audio.vadwebrtc
34-

R/whisper.R

+26-14
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,18 @@ align_skipped <- function(sentences, skipped, from = "from", to = "to"){
237237
#' language = "en", duration = 1000)
238238
#' }
239239
whisper <- function(x, use_gpu = FALSE, overwrite = FALSE, model_dir = Sys.getenv("WHISPER_MODEL_DIR", unset = getwd()), ...){
240-
if(x %in% c("tiny", "tiny.en", "base", "base.en", "small", "small.en", "medium", "medium.en", "large-v1", "large-v2", "large-v3", "large",
241-
"tiny-q5_1", "tiny.en-q5_1",
242-
"base-q5_1", "base.en-q5_1",
243-
"small-q5_1", "small.en-q5_1",
244-
"medium-q5_0", "medium.en-q5_0",
245-
"large-v2-q5_0", "large-v3-q5_0")){
240+
if(x %in% c("tiny", "tiny-q5_1", "tiny-q8_0",
241+
"tiny.en", "tiny.en-q5_1", "tiny.en-q8_0",
242+
"base", "base-q5_1", "base-q8_0",
243+
"base.en", "base.en-q5_1", "base.en-q8_0",
244+
"small", "small-q5_1", "small-q8_0",
245+
"small.en", "small.en-q5_1", "small.en-q8_0",
246+
"medium", "medium-q5_0", "medium-q8_0",
247+
"medium.en", "medium.en-q5_0", "medium.en-q8_0",
248+
"large-v1",
249+
"large-v2", "large-v2-q5_0", "large-v2-q8_0",
250+
"large-v3", "large-v3-q5_0",
251+
"large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0")){
246252
x <- whisper_download_model(x, overwrite = overwrite, model_dir = model_dir)
247253
}
248254
if(inherits(x, "whisper_download")){
@@ -263,8 +269,8 @@ whisper <- function(x, use_gpu = FALSE, overwrite = FALSE, model_dir = Sys.geten
263269
#' \item{base & base.en: 142 MB, RAM required: ~500 MB. Multilingual and English only version.}
264270
#' \item{small & small.en: 466 MB, RAM required: ~1.0 GB. Multilingual and English only version.}
265271
#' \item{medium & medium.en: 1.5 GB, RAM required: ~2.6 GB. Multilingual and English only version.}
266-
#' \item{large-v1, large-v2, large-v3: 2.9 GB, RAM required: ~4.7 GB. Multilingual}
267-
#' \item{quantised models: tiny-q5_1, tiny.en-q5_1, base-q5_1, base.en-q5_1, small-q5_1, small.en-q5_1, medium-q5_0, medium.en-q5_0, large-v2-q5_0 and large-v3-q5_0 (only - from version 1.5.4 onwards)}
272+
#' \item{large-v1, large-v2, large-v3, large-v3-turbo: 2.9 GB, RAM required: ~4.7 GB. Multilingual}
273+
#' \item{quantised models: tiny-q5_1, tiny-q8_0, tiny.en-q5_1, tiny.en-q8_0, base-q5_1, base-q8_0, base.en-q5_1, base_q8_0, small-q5_1, small-q8_0, small.en-q5_1, small.en-q8_0, medium-q5_0, medium-q8_0, medium.en-q5_0, medium.en-q8_0, large-v2-q5_0, large-v2-q8_0, large-v3-q5_0, large-v3-turbo-q5_0, and large-v3-turbo-q8_0 (only - from version 1.5.4 onwards)}
268274
#' }
269275
#' Note that the larger models may take longer than 60 seconds to download, so consider
270276
#' increasing the timeout option in R via \code{options(timeout = 120)}
@@ -314,12 +320,18 @@ whisper <- function(x, use_gpu = FALSE, overwrite = FALSE, model_dir = Sys.geten
314320
#' \dontshow{
315321
#' if(file.exists(path$file_model)) file.remove(path$file_model)
316322
#' }
317-
whisper_download_model <- function(x = c("tiny", "tiny.en", "base", "base.en", "small", "small.en", "medium", "medium.en", "large-v1", "large-v2", "large-v3", "large",
318-
"tiny-q5_1", "tiny.en-q5_1",
319-
"base-q5_1", "base.en-q5_1",
320-
"small-q5_1", "small.en-q5_1",
321-
"medium-q5_0", "medium.en-q5_0",
322-
"large-v2-q5_0", "large-v3-q5_0"),
323+
whisper_download_model <- function(x = c("tiny", "tiny-q5_1", "tiny-q8_0",
324+
"tiny.en", "tiny.en-q5_1", "tiny.en-q8_0",
325+
"base", "base-q5_1", "base-q8_0",
326+
"base.en", "base.en-q5_1", "base.en-q8_0",
327+
"small", "small-q5_1", "small-q8_0",
328+
"small.en", "small.en-q5_1", "small.en-q8_0",
329+
"medium", "medium-q5_0", "medium-q8_0",
330+
"medium.en", "medium.en-q5_0", "medium.en-q8_0",
331+
"large-v1",
332+
"large-v2", "large-v2-q5_0", "large-v2-q8_0",
333+
"large-v3", "large-v3-q5_0",
334+
"large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0"),
323335
model_dir = Sys.getenv("WHISPER_MODEL_DIR", unset = getwd()),
324336
repos = c("huggingface", "ggerganov"),
325337
version = c("1.5.4", "1.2.1"),

man/whisper_download_model.Rd

+8-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
using namespace Rcpp;
77

8+
#ifdef RCPP_USE_GLOBAL_ROSTREAM
9+
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10+
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11+
#endif
12+
813
// whisper_load_model
914
SEXP whisper_load_model(std::string model, bool use_gpu);
1015
RcppExport SEXP _audio_whisper_whisper_load_model(SEXP modelSEXP, SEXP use_gpuSEXP) {

0 commit comments

Comments
 (0)