@@ -3032,7 +3032,14 @@ int whisper_ctx_init_openvino_encoder(
30323032#endif 
30333033}
30343034
3035- struct  whisper_context  * whisper_init_from_file_no_state (const  char  * path_model, whisper_context_params params) {
3035+ struct  whisper_context_params  whisper_context_default_params () {
3036+     struct  whisper_context_params  result = {
3037+         /* .use_gpu    =*/ true ,
3038+     };
3039+     return  result;
3040+ }
3041+ 
3042+ struct  whisper_context  * whisper_init_from_file_with_params_no_state (const  char  * path_model, struct  whisper_context_params  params) {
30363043    log (" %s: loading model from '%s'\n " 
30373044
30383045    auto  fin = std::ifstream (path_model, std::ios::binary);
@@ -3061,7 +3068,7 @@ struct whisper_context * whisper_init_from_file_no_state(const char * path_model
30613068        fin->close ();
30623069    };
30633070
3064-     auto  ctx = whisper_init_no_state (&loader, params);
3071+     auto  ctx = whisper_init_with_params_no_state (&loader, params);
30653072
30663073    if  (ctx) {
30673074        ctx->path_model  = path_model;
@@ -3070,7 +3077,7 @@ struct whisper_context * whisper_init_from_file_no_state(const char * path_model
30703077    return  ctx;
30713078}
30723079
3073- struct  whisper_context  * whisper_init_from_buffer_no_state (void  * buffer, size_t  buffer_size, whisper_context_params params) {
3080+ struct  whisper_context  * whisper_init_from_buffer_with_params_no_state (void  * buffer, size_t  buffer_size,  struct  whisper_context_params  params) {
30743081    struct  buf_context  {
30753082        uint8_t * buffer;
30763083        size_t  size;
@@ -3104,10 +3111,10 @@ struct whisper_context * whisper_init_from_buffer_no_state(void * buffer, size_t
31043111
31053112    loader.close  = [](void  * /* ctx*/ 
31063113
3107-     return  whisper_init_no_state (&loader, params);
3114+     return  whisper_init_with_params_no_state (&loader, params);
31083115}
31093116
3110- struct  whisper_context  * whisper_init_no_state (struct  whisper_model_loader  * loader, whisper_context_params params) {
3117+ struct  whisper_context  * whisper_init_with_params_no_state (struct  whisper_model_loader  * loader,  struct  whisper_context_params  params) {
31113118    ggml_time_init ();
31123119
31133120    whisper_context * ctx = new  whisper_context;
@@ -3125,8 +3132,8 @@ struct whisper_context * whisper_init_no_state(struct whisper_model_loader * loa
31253132    return  ctx;
31263133}
31273134
3128- struct  whisper_context  * whisper_init_from_file (const  char  * path_model, whisper_context_params params) {
3129-     whisper_context * ctx = whisper_init_from_file_no_state (path_model, params);
3135+ struct  whisper_context  * whisper_init_from_file_with_params (const  char  * path_model,  struct  whisper_context_params  params) {
3136+     whisper_context * ctx = whisper_init_from_file_with_params_no_state (path_model, params);
31303137    if  (!ctx) {
31313138        return  nullptr ;
31323139    }
@@ -3140,8 +3147,8 @@ struct whisper_context * whisper_init_from_file(const char * path_model, whisper
31403147    return  ctx;
31413148}
31423149
3143- struct  whisper_context  * whisper_init_from_buffer (void  * buffer, size_t  buffer_size, whisper_context_params params) {
3144-     whisper_context * ctx = whisper_init_from_buffer_no_state (buffer, buffer_size, params);
3150+ struct  whisper_context  * whisper_init_from_buffer_with_params (void  * buffer, size_t  buffer_size,  struct  whisper_context_params  params) {
3151+     whisper_context * ctx = whisper_init_from_buffer_with_params_no_state (buffer, buffer_size, params);
31453152    if  (!ctx) {
31463153        return  nullptr ;
31473154    }
@@ -3155,8 +3162,8 @@ struct whisper_context * whisper_init_from_buffer(void * buffer, size_t buffer_s
31553162    return  ctx;
31563163}
31573164
3158- struct  whisper_context  * whisper_init (struct  whisper_model_loader  * loader, whisper_context_params params) {
3159-     whisper_context * ctx = whisper_init_no_state (loader, params);
3165+ struct  whisper_context  * whisper_init_with_params (struct  whisper_model_loader  * loader,  struct  whisper_context_params  params) {
3166+     whisper_context * ctx = whisper_init_with_params_no_state (loader, params);
31603167    if  (!ctx) {
31613168        return  nullptr ;
31623169    }
@@ -3170,6 +3177,30 @@ struct whisper_context * whisper_init(struct whisper_model_loader * loader, whis
31703177    return  ctx;
31713178}
31723179
3180+ struct  whisper_context  * whisper_init_from_file (const  char  * path_model) {
3181+     return  whisper_init_from_file_with_params (path_model, whisper_context_default_params ());
3182+ }
3183+ 
3184+ struct  whisper_context  * whisper_init_from_buffer (void  * buffer, size_t  buffer_size) {
3185+     return  whisper_init_from_buffer_with_params (buffer, buffer_size, whisper_context_default_params ());
3186+ }
3187+ 
3188+ struct  whisper_context  * whisper_init (struct  whisper_model_loader  * loader) {
3189+     return  whisper_init_with_params (loader, whisper_context_default_params ());
3190+ }
3191+ 
3192+ struct  whisper_context  * whisper_init_from_file_no_state (const  char  * path_model) {
3193+     return  whisper_init_from_file_with_params_no_state (path_model, whisper_context_default_params ());
3194+ }
3195+ 
3196+ struct  whisper_context  * whisper_init_from_buffer_no_state (void  * buffer, size_t  buffer_size) {
3197+     return  whisper_init_from_buffer_with_params_no_state (buffer, buffer_size, whisper_context_default_params ());
3198+ }
3199+ 
3200+ struct  whisper_context  * whisper_init_no_state (struct  whisper_model_loader  * loader) {
3201+     return  whisper_init_with_params_no_state (loader, whisper_context_default_params ());
3202+ }
3203+ 
31733204void  whisper_free_state (struct  whisper_state  * state)
31743205{
31753206    if  (state) {
0 commit comments