Skip to content

Commit ab8802f

Browse files
committed
minor
Signed-off-by: NickLucche <[email protected]>
1 parent a01373e commit ab8802f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

examples/online_serving/openai_transcription_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44

55
import httpx
6-
from openai import AsyncOpenAI
6+
from openai import OpenAI
77

88
from vllm.assets.audio import AudioAsset
99

@@ -13,15 +13,15 @@
1313
# Modify OpenAI's API key and API base to use vLLM's API server.
1414
openai_api_key = "EMPTY"
1515
openai_api_base = "http://localhost:8000/v1"
16-
client = AsyncOpenAI(
16+
client = OpenAI(
1717
api_key=openai_api_key,
1818
base_url=openai_api_base,
1919
)
2020

2121

22-
async def main():
22+
def sync_openai():
2323
with open(str(mary_had_lamb), "rb") as f:
24-
transcription = await client.audio.transcriptions.create(
24+
transcription = client.audio.transcriptions.create(
2525
file=f,
2626
model="openai/whisper-small",
2727
language="en",
@@ -30,7 +30,7 @@ async def main():
3030
print("transcription result:", transcription.text)
3131

3232

33-
asyncio.run(main())
33+
sync_openai()
3434

3535

3636
# OpenAI Transcription API client does not support streaming.

vllm/entrypoints/openai/serving_transcription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ async def transcription_stream_generator(
346346
# NOTE(NickLucche) user can't pass encoder prompts directly
347347
# at least not to Whisper. One indicator of the encoder
348348
# amount of processing is the log-mel spectogram length.
349-
num_prompt_tokens = ceil(audio_duration_s * self.model_sr /
350-
self.hop_length)
349+
num_prompt_tokens += ceil(audio_duration_s *
350+
self.model_sr / self.hop_length)
351351

352352
# We need to do it here, because if there are exceptions in
353353
# the result_generator, it needs to be sent as the FIRST

0 commit comments

Comments
 (0)