Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
  • Loading branch information
ulatekh and ggerganov committed Apr 9, 2024
1 parent 6d57fac commit f3fc0b3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/command/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ int main(int argc, char ** argv) {

struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;
cparams.fold_lowercase = params.model_fold_lc;
cparams.vocab_lc = params.model_fold_lc;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);

Expand Down
2 changes: 1 addition & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ int main(int argc, char ** argv) {

struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;
cparams.fold_lowercase = params.model_fold_lc;
cparams.vocab_lc = params.model_fold_lc;

if (!params.dtw.empty()) {
cparams.dtw_token_timestamps = true;
Expand Down
3 changes: 2 additions & 1 deletion whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,10 @@ static bool whisper_model_load(struct whisper_model_loader * loader, whisper_con
}

// If requested, output all text as lowercase.
if (wctx.params.fold_lowercase)
if (wctx.params.vocab_lc) {
std::transform(word.begin(), word.end(), word.begin(),
[](unsigned char c) { return std::tolower(c); });
}

vocab.token_to_id[word] = i;
vocab.id_to_token[i] = word;
Expand Down
2 changes: 1 addition & 1 deletion whisper.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extern "C" {
int gpu_device; // CUDA device

// Fold language tokens to lowercase
bool fold_lowercase;
bool vocab_lc;

// [EXPERIMENTAL] Token-level timestamps with DTW
bool dtw_token_timestamps;
Expand Down

0 comments on commit f3fc0b3

Please sign in to comment.