mtmd: support YuE2-3B (#32369)
* mtmd: support YuE2-3B * improve speed * add CFG * fix streaming * add cfg control from api * check ctx size * fix n_predict * add flow_steps config * nits * fix batch api * nits * adapt * mtmd: yue2 samples from its own saved logits The context logits belong to the last decode of any slot, so with several server slots the score and the unguided codes were sampled from another sequence. Keep the logits of each own decode in save_logits(), which also does the guidance mix. * mtmd: let the yue2 snake chain fuse The beta reshape landed between sqr and mul, so the mul, sin, sqr, mul, add chain was not consecutive and the backends never fused it. Expand both reshapes first, like qwen3tts does. --------- Co-authored-by: Pascal <admin@serveurperso.com>
This commit is contained in:
1 parent
ad5cbfa911
commit
92192d31e4
23 files changed
+1633
-23
No files matched your search
@@ -1540,6 +1540,10 @@ private:
|
||||
|
||||
if (has_cap_tts()) {
|
||||
slot.tts.ctx.init(ctx_tgt, mctx);
|
||||
if (!slot.tts.is_supported()) {
|
||||
SRV_ERR("%s", "the context cannot run the audio generation of this model\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SLT_TRC(slot, "new slot, n_ctx = %d\n", slot.n_ctx);
|
||||
@@ -1953,7 +1957,7 @@ private:
|
||||
task.tts_inp.data.seq_id = slot.id;
|
||||
const int32_t ret = slot.tts.ctx.set_input(task.tts_inp.get());
|
||||
if (ret == 2) {
|
||||
send_error(task, "invalid TTS input: the model may not support \"speed\" or \"loudness\", see the server log", ERROR_TYPE_INVALID_REQUEST);
|
||||
send_error(task, "invalid TTS input: the model may not support \"speed\", \"loudness\", \"cfg_scale\" or \"flow_steps\", see the server log", ERROR_TYPE_INVALID_REQUEST);
|
||||
return false;
|
||||
}
|
||||
if (ret != 0) {
|
||||
@@ -3647,7 +3651,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
const int32_t n_predict = slot.n_predict_max > 0 ? slot.n_predict_max : 512;
|
||||
const int32_t n_predict = slot.tts.ctx.max_frames(slot.n_predict_max);
|
||||
if (slot.tts.stop || slot.tts.n_decoded >= n_predict) {
|
||||
int32_t sample_rate = 0;
|
||||
const char * data = nullptr;
|
||||
@@ -5650,12 +5654,12 @@ json server_routes::get_model_info() const {
|
||||
// body of /tts and /v1/audio/speech; multipart form fields arrive as strings, the numeric and boolean params get their types back
|
||||
static json parse_tts_body(const server_http_req & req) {
|
||||
json body = json::parse(req.body);
|
||||
for (const char * k : { "top_k", "n_predict", "max_tokens", "seed" }) {
|
||||
for (const char * k : { "top_k", "n_predict", "max_tokens", "seed", "flow_steps" }) {
|
||||
if (body.contains(k) && body[k].is_string()) {
|
||||
body[k] = std::stoll(body[k].get<std::string>());
|
||||
}
|
||||
}
|
||||
for (const char * k : { "top_p", "temperature", "repeat_penalty", "speed", "loudness" }) {
|
||||
for (const char * k : { "top_p", "temperature", "repeat_penalty", "speed", "loudness", "cfg_scale" }) {
|
||||
if (body.contains(k) && body[k].is_string()) {
|
||||
body[k] = std::stof(body[k].get<std::string>());
|
||||
}
|
||||
@@ -7063,8 +7067,9 @@ std::unique_ptr<server_res_generator> server_routes::handle_tts_impl(const serve
|
||||
task.id = rd.get_new_id();
|
||||
rd.post_task(std::move(task));
|
||||
|
||||
// raw LE mono samples; audio/L16 would imply 16-bit big-endian (RFC 2586)
|
||||
const std::string pcm_type = "audio/pcm;rate=" + std::to_string(info.sample_rate);
|
||||
// raw LE samples, channels interleaved; audio/L16 would imply 16-bit big-endian (RFC 2586)
|
||||
const std::string pcm_type = "audio/pcm;rate=" + std::to_string(info.sample_rate) +
|
||||
(info.n_channels > 1 ? ";channels=" + std::to_string(info.n_channels) : "");
|
||||
const std::string content_type = pcm16 ? pcm_type + ";encoding=signed-int;bits=16"
|
||||
: response_format == "pcm" ? pcm_type + ";encoding=float;bits=32"
|
||||
: "audio/wav";
|
||||
|
||||
Reference in new issue
Block a user