server: support OAI /v1/audio/transcriptions API#21863
Conversation
|
I tried the provided test script but got until I added |
|
@kth8 thanks, that should be fixed in the latest commit CC @ggml-org/maintainers if someone can give an approval |
|
Thanks, @ngxson . Do you plan to support streaming encoding or live transcription? |
|
Hey @tdakhran , I don't have a plan, but I can publish a plan for doing so. I think the more complicated part is to implement a websocket endpoint (fortunately, it's supported by httplib now) If I understand correctly, the realtime transcription simply reduce the chunk size of the input audio, and text can be generated in-between 2 audio chunks, right? |
I actually packed two feature requests into a single message :)
|
|
The API prefixes responses with:
The prefix makes the API unusable for many purposes - how can it be removed? |
|
I don't think it can, remind that this is not a pure ASR model like whisper, but rather a general-purpose one. You can provide a specific prompt like |
I tried using the prompt from the official documentation at https://ai.google.dev/gemma/docs/core/model_card_4 which should output just the transcribed text: I wonder - should the response include just the channel text? It seems like it should, as the earlier text is reasoning info, which isn't appropriate for an OAI transcriptions response. |
|
hmm yeah that's not expected, the reasoning should be excluded from the response. I'll push a fix |
I recompiled with that patch, and can confirm that it fixes the issue. (My initial testing was flawed because I was using an outdated and/or broken chat template. Using the latest chat template included in the current |
|
It looks like this endpoint only works in direct server mode. when running in router mode I see logs that it is routing it to the correct model but the request never gets run or returned |
|
I got the same problem as @NickM-27: curl -v -F response_format=json -F model=Gemma4-E4B-vulkan -F prompt="Transcribe exactly." -F file=@kling-sample.mp3 http://gfxrig01:8081/v1/audio/transcriptions
* Host gfxrig01:8081 was resolved.
* IPv6: ******, ******
* IPv4: ******
* Trying [******]:8081...
* Connected to gfxrig01 (******) port 8081
> POST /v1/audio/transcriptions HTTP/1.1
> Host: gfxrig01:8081
> User-Agent: curl/8.7.1
> Accept: */*
> Content-Length: 780341
> Content-Type: multipart/form-data; boundary=------------------------VpTOuUqa5y0gLulttzO9ne
>
* upload completely sent off: 780341 bytesBut curl never finished. llama.cpp only shows: I am also using llama.cpp in router mode. When I upload a audio file via the built-in WebUI it works smoothly and fast. |
|
I just created a new issue in Github for this: |
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
|
gemma-4-E4B-it BF16 unusable for long 50 min audio - even using --ctx-size 131072. 76200 tokens input outputs duplicated, looped text even at temp=0. Maybe needs a fix? DId anyone tried this code with long time audio? |
Gemma 4 audio is trained on short clips (30s), so a full 50 min decode tends to loop. The endpoint doesn't chunk long audio yet, so splitting into <=30s parts before sending (or whisper for long-form) does the trick for now, and proper long-audio chunking could be a nice follow-up PR :) |
|
@ServeurpersoCom thanks for the reply, but the endpoint does chunk long audio - just in a weird way mixing up word and sentence layout after ~30 min into asr. Trying now other projects but no luck so far. |
|
@montvid could you test it with another runtime like vllm or mlx-vlm ? just to see if the model naturally behave that way, or there is a problem specific to llama.cpp |
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
No better solution than your implementation so far. I'm back to Faster Whisper and https://github.com/Purfview/whisper-standalone-win as it has better accuracy for me and word level timestamps that are more precise than whisper.cpp... |
* server: support OAI /v1/audio/transcriptions API * address autoreview comments * correct default response_format value
Overview
Fix #21852
Also support form multipart input data in the HTTP layer (note: input will be treated as string)
Tested with gemma-4-E4B-it
My test code:
Output:
Requirements