Spaces:
Sleeping
Sleeping
ggml : remove obsolete zeroing + comment fixes (#390)
Browse files- ggml.c +1 -5
- whisper.cpp +1 -0
- whisper.h +2 -2
ggml.c
CHANGED
|
@@ -3724,8 +3724,6 @@ static void ggml_compute_forward_sum_f32(
|
|
| 3724 |
assert(ggml_is_scalar(dst));
|
| 3725 |
assert(src0->nb[0] == sizeof(float));
|
| 3726 |
|
| 3727 |
-
*(float *) (dst->data) = 0.0f;
|
| 3728 |
-
|
| 3729 |
const int ne00 = src0->ne[0];
|
| 3730 |
const int ne01 = src0->ne[1];
|
| 3731 |
const int ne02 = src0->ne[2];
|
|
@@ -3811,8 +3809,6 @@ static void ggml_compute_forward_mean_f32(
|
|
| 3811 |
for (int i03 = 0; i03 < ne03; i03++) {
|
| 3812 |
for (int i02 = 0; i02 < ne02; i02++) {
|
| 3813 |
for (int i01 = 0; i01 < ne01; i01++) {
|
| 3814 |
-
*(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3) = 0.0f;
|
| 3815 |
-
|
| 3816 |
ggml_vec_sum_f32(ne00,
|
| 3817 |
(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3),
|
| 3818 |
(float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03));
|
|
@@ -4791,7 +4787,7 @@ static void ggml_compute_forward_mul_mat_f16_f32(
|
|
| 4791 |
}
|
| 4792 |
}
|
| 4793 |
} else {
|
| 4794 |
-
// parallelize by src1 columns using
|
| 4795 |
// each thread has its own work data
|
| 4796 |
// during FINALIZE we accumulate all work data into dst
|
| 4797 |
|
|
|
|
| 3724 |
assert(ggml_is_scalar(dst));
|
| 3725 |
assert(src0->nb[0] == sizeof(float));
|
| 3726 |
|
|
|
|
|
|
|
| 3727 |
const int ne00 = src0->ne[0];
|
| 3728 |
const int ne01 = src0->ne[1];
|
| 3729 |
const int ne02 = src0->ne[2];
|
|
|
|
| 3809 |
for (int i03 = 0; i03 < ne03; i03++) {
|
| 3810 |
for (int i02 = 0; i02 < ne02; i02++) {
|
| 3811 |
for (int i01 = 0; i01 < ne01; i01++) {
|
|
|
|
|
|
|
| 3812 |
ggml_vec_sum_f32(ne00,
|
| 3813 |
(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3),
|
| 3814 |
(float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03));
|
|
|
|
| 4787 |
}
|
| 4788 |
}
|
| 4789 |
} else {
|
| 4790 |
+
// parallelize by src1 columns using ggml_vec_mad_f16
|
| 4791 |
// each thread has its own work data
|
| 4792 |
// during FINALIZE we accumulate all work data into dst
|
| 4793 |
|
whisper.cpp
CHANGED
|
@@ -1471,6 +1471,7 @@ static bool whisper_encode(
|
|
| 1471 |
}
|
| 1472 |
|
| 1473 |
ggml_graph_compute(ctx0, &gf);
|
|
|
|
| 1474 |
}
|
| 1475 |
|
| 1476 |
////////////////////////////////////////////////////////////////////////////
|
|
|
|
| 1471 |
}
|
| 1472 |
|
| 1473 |
ggml_graph_compute(ctx0, &gf);
|
| 1474 |
+
//ggml_graph_print(&gf);
|
| 1475 |
}
|
| 1476 |
|
| 1477 |
////////////////////////////////////////////////////////////////////////////
|
whisper.h
CHANGED
|
@@ -93,8 +93,8 @@ extern "C" {
|
|
| 93 |
void (*close)(void * ctx);
|
| 94 |
} whisper_model_loader;
|
| 95 |
|
| 96 |
-
// Various
|
| 97 |
-
//
|
| 98 |
// Return NULL on failure
|
| 99 |
WHISPER_API struct whisper_context * whisper_init_from_file(const char * path_model);
|
| 100 |
WHISPER_API struct whisper_context * whisper_init_from_buffer(void * buffer, size_t buffer_size);
|
|
|
|
| 93 |
void (*close)(void * ctx);
|
| 94 |
} whisper_model_loader;
|
| 95 |
|
| 96 |
+
// Various functions for loading a ggml whisper model.
|
| 97 |
+
// Allocate (almost) all memory needed for the model.
|
| 98 |
// Return NULL on failure
|
| 99 |
WHISPER_API struct whisper_context * whisper_init_from_file(const char * path_model);
|
| 100 |
WHISPER_API struct whisper_context * whisper_init_from_buffer(void * buffer, size_t buffer_size);
|