Skip to content

Commit

Permalink
chore: apply patches
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Nov 7, 2023
1 parent a50b88a commit 8ed91c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/coreml/whisper-encoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

// select which device to run the Core ML model on
MLModelConfiguration *config = [[MLModelConfiguration alloc] init];
config.computeUnits = MLComputeUnitsCPUAndGPU;
//config.computeUnits = MLComputeUnitsCPUAndGPU;
//config.computeUnits = MLComputeUnitsCPUAndNeuralEngine;
//config.computeUnits = MLComputeUnitsAll;
config.computeUnits = MLComputeUnitsAll;

const void * data = CFBridgingRetain([[whisper_encoder_impl alloc] initWithContentsOfURL:url_model configuration:config error:nil]);

Expand Down
4 changes: 4 additions & 0 deletions cpp/whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,9 @@ struct whisper_state * whisper_init_state(whisper_context * ctx) {
log("%s: kv cross size = %7.2f MB\n", __func__, memory_size / 1024.0 / 1024.0);
}


#ifdef WHISPER_USE_COREML
if (ctx->params.use_coreml) {
const auto path_coreml = whisper_get_coreml_path_encoder(ctx->path_model);

log("%s: loading Core ML model from '%s'\n", __func__, path_coreml.c_str());
Expand All @@ -2871,6 +2873,7 @@ struct whisper_state * whisper_init_state(whisper_context * ctx) {
} else {
log("%s: Core ML model loaded\n", __func__);
}
}
#endif

state->logits.reserve(ctx->vocab.n_vocab * ctx->model.hparams.n_text_ctx);
Expand Down Expand Up @@ -3048,6 +3051,7 @@ int whisper_ctx_init_openvino_encoder(
struct whisper_context_params whisper_context_default_params() {
struct whisper_context_params result = {
/*.use_gpu =*/ true,
/*.use_coreml =*/ false,
};
return result;
}
Expand Down
1 change: 1 addition & 0 deletions cpp/whisper.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern "C" {

struct whisper_context_params {
bool use_gpu;
bool use_coreml;
};

typedef struct whisper_token_data {
Expand Down

0 comments on commit 8ed91c1

Please sign in to comment.