mtmd: drama3 voice cloning (#32586)
* mtmd: drama3 voice cloning The Fish S2 codec encoder (fish_s2_spkenc) now also serves drama3: - conversion: drama3 writes the codec encoder and the audio encoder KV, shared with fish_s2 - fish_s2_spkenc: outputs the codes of the clip (gen-side reference) and, in a drama3_gen mmproj, builds the drama3 backbone rows (E_lm[semantic] + E_cb[1][code 1]) / sqrt(2) - drama3_gen tower: teacher forcing when the caller gives the codes of the next frame - drama3 pipeline: reference-bracket-v1 prompt with one reference (vLLM-Omni fish_omni), the reference frames go through the backbone as codec rows and through the tower with their codes - mtmd_gen_state_get_ref_codes(): read-only access to the reference codes of a gen state Claude-Session: https://claude.ai/code/session_01PpX3DmaxNSmJbxGaxnUBrX * fix correctness * clean up * rm redundant code * fish_s2: rm unused import --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This commit is contained in:
1 parent
6f5c9ad217
commit
34ff2e047c
12 files changed
+414
-193
No files matched your search
@@ -130,9 +130,19 @@ ggml_cgraph * mtmd_graph_drama3_gen::build_tower() {
|
||||
ggml_set_name(inp_pos, "inp_pos");
|
||||
ggml_set_input(inp_pos);
|
||||
|
||||
ggml_tensor * inp_rand = ggml_new_tensor_1d(ctx0, GGML_TYPE_F32, n_heads);
|
||||
ggml_set_name(inp_rand, "inp_rand");
|
||||
ggml_set_input(inp_rand);
|
||||
// teacher forcing (reference rows of a voice clone): codes 1.. of the frame are given, nothing is sampled
|
||||
const bool forced = n_frames == 2;
|
||||
ggml_tensor * inp_rand = nullptr;
|
||||
ggml_tensor * inp_force = nullptr;
|
||||
if (forced) {
|
||||
inp_force = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_heads);
|
||||
ggml_set_name(inp_force, "inp_force");
|
||||
ggml_set_input(inp_force);
|
||||
} else {
|
||||
inp_rand = ggml_new_tensor_1d(ctx0, GGML_TYPE_F32, n_heads);
|
||||
ggml_set_name(inp_rand, "inp_rand");
|
||||
ggml_set_input(inp_rand);
|
||||
}
|
||||
|
||||
ggml_tensor * mask = ggml_view_1d(ctx0, inp_scale, 1, 0);
|
||||
ggml_tensor * extra_on = ggml_view_1d(ctx0, inp_scale, 1, sizeof(float));
|
||||
@@ -152,6 +162,11 @@ ggml_cgraph * mtmd_graph_drama3_gen::build_tower() {
|
||||
continue;
|
||||
}
|
||||
const int ih = il - n_shared;
|
||||
if (forced) {
|
||||
code = ggml_view_1d(ctx0, inp_force, 1, (size_t) ih * sizeof(int32_t));
|
||||
out_codes = cg.cache_set(out_codes, ih + 1, code);
|
||||
continue;
|
||||
}
|
||||
ggml_tensor * head = ggml_view_2d(ctx0, model.gen_code_head_w, model.gen_code_head_w->ne[0], model.gen_code_head_w->ne[1],
|
||||
model.gen_code_head_w->nb[1], (size_t) ih * model.gen_code_head_w->nb[2]);
|
||||
ggml_tensor * logits = ggml_mul_mat(ctx0, head, x);
|
||||
|
||||
Reference in new issue
Block a user