@@ -6685,7 +6685,7 @@ static void whisper_exp_compute_token_level_timestamps(
6685
6685
// based on
6686
6686
// https://github.com/openai/whisper/blob/main/whisper/timing.py#L83
6687
6687
static ggml_tensor * dtw_and_backtrace (ggml_context * ctx, ggml_tensor * x) {
6688
- WHISPER_ASSERT (x-> n_dims == 2 );
6688
+ WHISPER_ASSERT (ggml_n_dims (x) == 2 );
6689
6689
6690
6690
int64_t N = x->ne [0 ];
6691
6691
int64_t M = x->ne [1 ];
@@ -6773,7 +6773,7 @@ static ggml_tensor * dtw_and_backtrace(ggml_context * ctx, ggml_tensor * x) {
6773
6773
static ggml_tensor * median_filter (ggml_context * ctx, ggml_tensor * x, int filter_width) {
6774
6774
WHISPER_ASSERT (filter_width < x->ne [2 ]);
6775
6775
WHISPER_ASSERT (filter_width % 2 );
6776
- WHISPER_ASSERT (x-> n_dims == 3 );
6776
+ WHISPER_ASSERT (ggml_n_dims (x) == 3 );
6777
6777
WHISPER_ASSERT (x->type == GGML_TYPE_F32);
6778
6778
6779
6779
std::vector<float > filter;
@@ -6918,7 +6918,7 @@ static void whisper_exp_compute_token_level_timestamps_dtw(
6918
6918
// operation (after median filter)
6919
6919
// IN: Tensor with N_TOKENS*N_AUDIO_TOKENS*N_ALIGNMENT_HEADS dims
6920
6920
// OUT: Tensor with N_ALIGNMENT_HEADS*N_TOKENS*N_AUDIO_TOKENS dims
6921
- w = ggml_norm (gctx, w, 0 );
6921
+ w = ggml_norm (gctx, w, 1e-9 );
6922
6922
w = ggml_permute (gctx, ggml_permute (gctx, w, 2 , 1 , 0 ,3 ), 0 , 2 , 1 , 3 );
6923
6923
struct ggml_cgraph * gf = ggml_new_graph (gctx);
6924
6924
ggml_build_forward_expand (gf, w);
@@ -6933,9 +6933,7 @@ static void whisper_exp_compute_token_level_timestamps_dtw(
6933
6933
// IN: Tensor with N_ALIGNMENT_HEADS*N_TOKENS*N_AUDIO_TOKENS dims
6934
6934
// OUT: Tensor with N_TOKENS*N_AUDIO_TOKENS dims
6935
6935
w = ggml_mean (gctx, w);
6936
- ggml_tensor * scale = ggml_new_tensor_1d (gctx, GGML_TYPE_F32, 1 );
6937
- ggml_set_f32_1d (scale, 0 , -1 );
6938
- w = ggml_scale (gctx, w, scale);
6936
+ w = ggml_scale (gctx, w, -1.0 );
6939
6937
w = ggml_reshape_2d (gctx, w, w->ne [1 ], w->ne [2 ]);
6940
6938
struct ggml_cgraph * gf2 = ggml_new_graph (gctx);
6941
6939
ggml_build_forward_expand (gf2, w);
0 commit comments