mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-08-11 16:46:16 +02:00
coreml : add code to toggle Core ML config (CPU, ANE, GPU)
This commit is contained in:
@ -22,7 +22,13 @@ struct whisper_coreml_context * whisper_coreml_init(const char * path_model) {
|
|||||||
|
|
||||||
NSURL * url_model = [NSURL fileURLWithPath: path_model_str];
|
NSURL * url_model = [NSURL fileURLWithPath: path_model_str];
|
||||||
|
|
||||||
const void * data = CFBridgingRetain([[whisper_encoder_impl alloc] initWithContentsOfURL:url_model error:nil]);
|
// select which device to run the Core ML model on
|
||||||
|
MLModelConfiguration *config = [[MLModelConfiguration alloc] init];
|
||||||
|
//config.computeUnits = MLComputeUnitsCPUAndGPU;
|
||||||
|
config.computeUnits = MLComputeUnitsCPUAndNeuralEngine;
|
||||||
|
//config.computeUnits = MLComputeUnitsAll;
|
||||||
|
|
||||||
|
const void * data = CFBridgingRetain([[whisper_encoder_impl alloc] initWithContentsOfURL:url_model configuration:config error:nil]);
|
||||||
|
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user