server: Enable transcriptions API for LFM2-Audio#22000
Conversation
ngxson
left a comment
There was a problem hiding this comment.
IMO the current proposal is a bit complicated. Instead, any prompt-related should be confined to the common/chat.cpp|h system
For example, adding a common_chat_get_asr_prompt() that return the prompt specific to LFM2. See common_chat_params_init_lfm2 for now model-specific chat template is handled.
This way, you don't have to make any changes to libmtmd
@ngxson, instructions e.g. for ASR can vary from model to model.
I'm struggling to see how these two can be detected for the ASR use case in UPD: it actually worked, thank you @ngxson ! |
6c1b038 to
11b292d
Compare
| std::vector<raw_buffer> files; | ||
| json body = convert_transcriptions_to_chatcmpl( | ||
| json::parse(req.body), | ||
| meta->chat_params.tmpls.get(), |
There was a problem hiding this comment.
probably better to pass the whole chat_params here instead of just tmpls, that will make this function to be more aligned with oaicompat_chat_params_parse
There was a problem hiding this comment.
Yeah, gonna think about it, probably might be a good idea to unify it and to just pass the entire JSON messages "preset" array.
There was a problem hiding this comment.
@pwilkin for now I think it should be good to merge, right? If so, can you give an approval? (This can be improved in a follow-up PR if you have any ideas.) Thanks!
|
@tdakhran can you resolve the conflict? |
11b292d to
f4a9fc3
Compare
ngxson
left a comment
There was a problem hiding this comment.
Looks good, let's merge when the CI passes
Overview
#21863 added support for /v1/audio/transcriptions API with the assumption that models expect
[{"role":"user","content":"Transcribe audio to text<__media__>"}]format.This doesn't hold, e.g., for LiquidAI/LFM2.5-Audio-1.5B-GGUF.
In PR, I try to relax this assumption by defining the model-specific strategy and using it in the server.
Additional information
With this change, transcription works correctly for LiquidAI/LFM2.5-Audio-1.5B-GGUF and adds a mechanism for defining a strategy for future models.
To test, start server with
Use the code below to inference
Output
Requirements