]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
ggml : remove obsolete zeroing + comment fixes (#390)
authorGeorgi Gerganov <redacted>
Sun, 8 Jan 2023 10:35:56 +0000 (12:35 +0200)
committerGeorgi Gerganov <redacted>
Sun, 8 Jan 2023 18:21:03 +0000 (20:21 +0200)
ggml.c
whisper.cpp
whisper.h

diff --git a/ggml.c b/ggml.c
index 3ea1e61ba04dffaa0c00f51e024f1d7670e4d2ad..c59ee64af00c48455e49510ca1760d17e2b9169d 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -3724,8 +3724,6 @@ static void ggml_compute_forward_sum_f32(
     assert(ggml_is_scalar(dst));
     assert(src0->nb[0] == sizeof(float));
 
-    *(float *) (dst->data) = 0.0f;
-
     const int ne00 = src0->ne[0];
     const int ne01 = src0->ne[1];
     const int ne02 = src0->ne[2];
@@ -3811,8 +3809,6 @@ static void ggml_compute_forward_mean_f32(
     for (int i03 = 0; i03 < ne03; i03++) {
         for (int i02 = 0; i02 < ne02; i02++) {
             for (int i01 = 0; i01 < ne01; i01++) {
-                *(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3) = 0.0f;
-
                 ggml_vec_sum_f32(ne00,
                         (float *) ((char *)  dst->data + i01*nb1  + i02*nb2  + i03*nb3),
                         (float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03));
@@ -4791,7 +4787,7 @@ static void ggml_compute_forward_mul_mat_f16_f32(
             }
         }
     } else {
-        // parallelize by src1 columns using ggml_vec_mad_f32
+        // parallelize by src1 columns using ggml_vec_mad_f16
         // each thread has its own work data
         // during FINALIZE we accumulate all work data into dst
 
index f1985a496d36f52713520994972d62546473a4b1..a64505693f718ec55c5a3c438ec619d271865a20 100644 (file)
@@ -1471,6 +1471,7 @@ static bool whisper_encode(
         }
 
         ggml_graph_compute(ctx0, &gf);
+        //ggml_graph_print(&gf);
     }
 
     ////////////////////////////////////////////////////////////////////////////
index 582138f9ddb7fbfe95fdb57fcb3a11d601007731..63f61af5114f2cb8864219b9b9615bea64126c2d 100644 (file)
--- a/whisper.h
+++ b/whisper.h
@@ -93,8 +93,8 @@ extern "C" {
         void  (*close)(void * ctx);
     } whisper_model_loader;
 
-    // Various function to load a ggml whisper model.
-    // Allocates (almost) all memory needed for the model.
+    // Various functions for loading a ggml whisper model.
+    // Allocate (almost) all memory needed for the model.
     // Return NULL on failure
     WHISPER_API struct whisper_context * whisper_init_from_file(const char * path_model);
     WHISPER_API struct whisper_context * whisper_init_from_buffer(void * buffer, size_t buffer_size);