Skip to content

Commit

Permalink
fix: temp disable dtw_token_timestamps in cparams
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Nov 5, 2024
1 parent 092bb6f commit 6301734
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions android/src/main/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ Java_com_rnwhisper_WhisperContext_initContext(
JNIEnv *env, jobject thiz, jstring model_path_str) {
UNUSED(thiz);
struct whisper_context_params cparams;
cparams.dtw_token_timestamps = false;

struct whisper_context *context = nullptr;
const char *model_path_chars = env->GetStringUTFChars(model_path_str, nullptr);
context = whisper_init_from_file_with_params(model_path_chars, cparams);
Expand All @@ -171,6 +173,8 @@ Java_com_rnwhisper_WhisperContext_initContextWithAsset(
) {
UNUSED(thiz);
struct whisper_context_params cparams;
cparams.dtw_token_timestamps = false;

struct whisper_context *context = nullptr;
const char *model_path_chars = env->GetStringUTFChars(model_path_str, nullptr);
context = whisper_init_from_asset(env, asset_manager, model_path_chars, cparams);
Expand All @@ -186,6 +190,8 @@ Java_com_rnwhisper_WhisperContext_initContextWithInputStream(
) {
UNUSED(thiz);
struct whisper_context_params cparams;
cparams.dtw_token_timestamps = false;

struct whisper_context *context = nullptr;
context = whisper_init_from_input_stream(env, input_stream, cparams);
return reinterpret_cast<jlong>(context);
Expand Down
3 changes: 3 additions & 0 deletions ios/RNWhisperContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ + (instancetype)initWithModelPath:(NSString *)modelPath
cparams.use_gpu = !noMetal;
cparams.flash_attn = useFlashAttn;

// TODO: Figure out why it leads to re-init crash
cparams.dtw_token_timestamps = false;

cparams.use_coreml = !noCoreML;
#ifndef WHISPER_USE_COREML
if (cparams.use_coreml) {
Expand Down

0 comments on commit 6301734

Please sign in to comment.