Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whisper support #5964

Closed
wants to merge 16 commits into from
Prev Previous commit
Next Next commit
added predict lang in whisper example
  • Loading branch information
huseinzol05 committed Jun 29, 2024
commit 2d62f4559fa9ec0f3311416fffeb5c8bfa6f95f6
12 changes: 9 additions & 3 deletions examples/whisper_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ def main():

r = requests.get('https://github.com/mesolitica/malaya-speech/raw/master/speech/singlish/singlish0.wav')
y = audio.decode_example(audio.encode_example(r.content))['array']
prompt = '<|startoftranscript|><|en|><|transcribe|>'

output_lang = llm.generate({
"prompt_token_ids": [50258],
"multi_modal_data": AudioData(y),
}, sampling_params = SamplingParams(max_tokens = 1, temperature = 0))

outputs = llm.generate({
"prompt": prompt,
"prompt_token_ids": [50258, output_lang[0].outputs[0].token_ids[0], 50360],
"multi_modal_data": AudioData(y),
})
}, sampling_params = SamplingParams(max_tokens = 10, temperature = 0))

print(outputs[0].outputs[0].text)


Expand Down