mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-18 21:15:38 +08:00
[CI] Re-use whisper_client for all tests (#30148)
Signed-off-by: NickLucche <nlucches@redhat.com>
This commit is contained in:
parent
3633035a3f
commit
e23ca3a0e8
@ -32,24 +32,20 @@ async def whisper_client(server):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_basic_audio(mary_had_lamb):
|
async def test_basic_audio(whisper_client, mary_had_lamb):
|
||||||
server_args = ["--enforce-eager"]
|
|
||||||
|
|
||||||
# Based on https://github.com/openai/openai-cookbook/blob/main/examples/Whisper_prompting_guide.ipynb.
|
# Based on https://github.com/openai/openai-cookbook/blob/main/examples/Whisper_prompting_guide.ipynb.
|
||||||
with RemoteOpenAIServer(MODEL_NAME, server_args) as remote_server:
|
transcription = await whisper_client.audio.transcriptions.create(
|
||||||
client = remote_server.get_async_client()
|
model=MODEL_NAME,
|
||||||
transcription = await client.audio.transcriptions.create(
|
file=mary_had_lamb,
|
||||||
model=MODEL_NAME,
|
language="en",
|
||||||
file=mary_had_lamb,
|
response_format="text",
|
||||||
language="en",
|
temperature=0.0,
|
||||||
response_format="text",
|
)
|
||||||
temperature=0.0,
|
out = json.loads(transcription)
|
||||||
)
|
out_text = out["text"]
|
||||||
out = json.loads(transcription)
|
out_usage = out["usage"]
|
||||||
out_text = out["text"]
|
assert "Mary had a little lamb," in out_text
|
||||||
out_usage = out["usage"]
|
assert out_usage["seconds"] == 16, out_usage["seconds"]
|
||||||
assert "Mary had a little lamb," in out_text
|
|
||||||
assert out_usage["seconds"] == 16, out_usage["seconds"]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user