@@ -1405,6 +1405,7 @@ static bool whisper_encode(
1405
1405
}
1406
1406
}
1407
1407
1408
+ #ifndef WHISPER_USE_COREML
1408
1409
struct ggml_tensor * cur;
1409
1410
1410
1411
// convolution + gelu
@@ -1704,9 +1705,6 @@ static bool whisper_encode(
1704
1705
wctx.use_buf (ctx0, -1 );
1705
1706
1706
1707
// run the computation
1707
- #ifdef WHISPER_USE_COREML
1708
- whisper_coreml_encode (wctx.ctx_coreml , (float *) mel->data , (float *) cur->data );
1709
- #else
1710
1708
{
1711
1709
struct ggml_cgraph gf = {};
1712
1710
gf.n_threads = n_threads;
@@ -1716,6 +1714,12 @@ static bool whisper_encode(
1716
1714
1717
1715
// ggml_graph_print(&gf);
1718
1716
}
1717
+ #else
1718
+ wctx.use_buf (ctx0, -1 );
1719
+
1720
+ struct ggml_tensor * cur = ggml_new_tensor_2d (ctx0, GGML_TYPE_F32, n_state, n_ctx);
1721
+
1722
+ whisper_coreml_encode (wctx.ctx_coreml , (float *) mel->data , (float *) cur->data );
1719
1723
#endif
1720
1724
1721
1725
// cur
@@ -2569,12 +2573,15 @@ struct whisper_context * whisper_init_from_file(const char * path_model) {
2569
2573
#ifdef WHISPER_USE_COREML
2570
2574
const auto path_coreml = whisper_get_coreml_path (ctx->path_model );
2571
2575
fprintf (stderr, " %s: loading Core ML model from '%s'\n " , __func__, path_coreml.c_str ());
2576
+ fprintf (stderr, " %s: first run on a device may take a while ...\n " , __func__);
2572
2577
2573
2578
ctx->ctx_coreml = whisper_coreml_init (path_coreml.c_str ());
2574
2579
if (!ctx->ctx_coreml ) {
2575
2580
fprintf (stderr, " %s: failed to load Core ML model from '%s'\n " , __func__, path_coreml.c_str ());
2576
2581
return nullptr ;
2577
2582
}
2583
+
2584
+ fprintf (stderr, " %s: Core ML model loaded\n " , __func__);
2578
2585
#endif
2579
2586
}
2580
2587
0 commit comments