From c207eed431fba089082f33ab98dd1c639a8cd710 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 26 Nov 2022 16:27:04 +0200 Subject: [PATCH] whisper.objc : fix build warnings --- .../whisper.objc.xcodeproj/project.pbxproj | 2 ++ examples/whisper.objc/whisper.objc/ViewController.m | 8 ++++---- whisper.cpp | 13 +++---------- whisper.h | 6 +++--- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj b/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj index bef9ce1..9a9ee54 100644 --- a/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj +++ b/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj @@ -309,6 +309,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = P8JZH34X63; + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = whisper.objc/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -336,6 +337,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = P8JZH34X63; + GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = whisper.objc/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; diff --git a/examples/whisper.objc/whisper.objc/ViewController.m b/examples/whisper.objc/whisper.objc/ViewController.m index b23354b..4804471 100644 --- a/examples/whisper.objc/whisper.objc/ViewController.m +++ b/examples/whisper.objc/whisper.objc/ViewController.m @@ -21,9 +21,9 @@ void AudioInputCallback(void * inUserData, @interface ViewController () -@property (weak, nonatomic) IBOutlet UILabel *labelStatusInp; -@property (weak, nonatomic) IBOutlet UIButton *buttonToggleCapture; -@property (weak, nonatomic) IBOutlet UIButton *buttonTranscribe; +@property (weak, nonatomic) IBOutlet UILabel *labelStatusInp; +@property (weak, nonatomic) IBOutlet UIButton *buttonToggleCapture; +@property (weak, nonatomic) IBOutlet UIButton *buttonTranscribe; @property (weak, nonatomic) IBOutlet UITextView *textviewResult; @end @@ -32,7 +32,7 @@ void AudioInputCallback(void * inUserData, - (void)setupAudioFormat:(AudioStreamBasicDescription*)format { - format->mSampleRate = 16000; + format->mSampleRate = WHISPER_SAMPLE_RATE; format->mFormatID = kAudioFormatLinearPCM; format->mFramesPerPacket = 1; format->mChannelsPerFrame = 1; diff --git a/whisper.cpp b/whisper.cpp index de97bb7..9e27ab1 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2360,11 +2360,11 @@ whisper_token whisper_token_beg(struct whisper_context * ctx) { return ctx->vocab.token_beg; } -whisper_token whisper_token_translate() { +whisper_token whisper_token_translate(void) { return whisper_vocab::token_translate; } -whisper_token whisper_token_transcribe() { +whisper_token whisper_token_transcribe(void) { return whisper_vocab::token_transcribe; } @@ -2921,10 +2921,6 @@ int whisper_full_parallel( model.memory_cross_k = ggml_new_tensor_1d(ctx, GGML_TYPE_F16, n_elements); model.memory_cross_v = ggml_new_tensor_1d(ctx, GGML_TYPE_F16, n_elements); } - - const size_t memory_size = - ggml_nbytes(model.memory_k) + ggml_nbytes(model.memory_v) + - ggml_nbytes(model.memory_cross_k) + ggml_nbytes(model.memory_cross_v); } } @@ -3044,7 +3040,7 @@ float whisper_full_get_token_p(struct whisper_context * ctx, int i_segment, int return ctx->result_all[i_segment].tokens[i_token].p; } -const char * whisper_print_system_info() { +const char * whisper_print_system_info(void) { static std::string s; s = ""; @@ -3145,9 +3141,6 @@ static void whisper_exp_compute_token_level_timestamps( const int64_t t0 = segment.t0; const int64_t t1 = segment.t1; - const int s0 = timestamp_to_sample(t0, n_samples); - const int s1 = timestamp_to_sample(t1, n_samples); - const int n = tokens.size(); if (n == 0) { diff --git a/whisper.h b/whisper.h index 07d422c..b0fb2d9 100644 --- a/whisper.h +++ b/whisper.h @@ -162,8 +162,8 @@ extern "C" { WHISPER_API whisper_token whisper_token_beg (struct whisper_context * ctx); // Task tokens - WHISPER_API whisper_token whisper_token_translate (); - WHISPER_API whisper_token whisper_token_transcribe(); + WHISPER_API whisper_token whisper_token_translate (void); + WHISPER_API whisper_token whisper_token_transcribe(void); // Performance information WHISPER_API void whisper_print_timings(struct whisper_context * ctx); @@ -276,7 +276,7 @@ extern "C" { WHISPER_API float whisper_full_get_token_p(struct whisper_context * ctx, int i_segment, int i_token); // Print system information - WHISPER_API const char * whisper_print_system_info(); + WHISPER_API const char * whisper_print_system_info(void); #ifdef __cplusplus }