Skip to content

Commit 4b13a68

Browse files
authored
mtmd: fix patch_size initialized to random value in audio models (#17128)
* mtmd: fix patch_size initialized to random value in audio models * add default hparams
1 parent 9898b57 commit 4b13a68

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tools/mtmd/clip.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ enum patch_merge_type {
160160
};
161161

162162
struct clip_hparams {
163-
int32_t image_size;
164-
int32_t patch_size;
165-
int32_t n_embd;
166-
int32_t n_ff;
167-
int32_t projection_dim;
168-
int32_t n_head;
169-
int32_t n_layer;
163+
int32_t image_size = 0;
164+
int32_t patch_size = 0;
165+
int32_t n_embd = 0;
166+
int32_t n_ff = 0;
167+
int32_t projection_dim = 0;
168+
int32_t n_head = 0;
169+
int32_t n_layer = 0;
170170
// idefics3
171171
int32_t image_longest_edge = 0;
172172
int32_t image_min_pixels = -1;
@@ -2683,6 +2683,9 @@ struct clip_model_loader {
26832683
}
26842684
} else if (is_audio) {
26852685
get_u32(KEY_A_NUM_MEL_BINS, hparams.n_mel_bins);
2686+
// some hparams are unused, but still need to set to avoid issues
2687+
hparams.image_size = 0;
2688+
hparams.patch_size = 1;
26862689

26872690
} else {
26882691
GGML_ASSERT(false && "unknown modality");

0 commit comments

Comments
 (0)