Initial commit: FunASR Speech Recognition Toolkit
Update API Documentation / build-api-docs (push) Has been cancelled
Update API Documentation / build-api-docs (push) Has been cancelled
Add complete FunASR codebase including models, runtime, and documentation.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
|
||||
# MIT License (https://opensource.org/licenses/MIT)
|
||||
|
||||
# To install requirements: pip3 install -U "funasr[llm]"
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(model="Qwen-Audio")
|
||||
|
||||
audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac"
|
||||
prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"
|
||||
|
||||
res = model.generate(input=audio_in, prompt=prompt)
|
||||
print(res)
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
|
||||
# MIT License (https://opensource.org/licenses/MIT)
|
||||
|
||||
# To install requirements: pip3 install -U "funasr[llm]"
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(model="Qwen/Qwen-Audio-Chat")
|
||||
|
||||
audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac"
|
||||
|
||||
# 1st dialogue turn
|
||||
prompt = "what does the person say?"
|
||||
cache = {"history": None}
|
||||
res = model.generate(input=audio_in, prompt=prompt, cache=cache)
|
||||
print(res)
|
||||
|
||||
|
||||
# 2nd dialogue turn
|
||||
prompt = 'Find the start time and end time of the word "middle classes"'
|
||||
res = model.generate(input=None, prompt=prompt, cache=cache)
|
||||
print(res)
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
|
||||
# MIT License (https://opensource.org/licenses/MIT)
|
||||
|
||||
# To install requirements: pip3 install -U "funasr[llm]"
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(
|
||||
model="Qwen-Audio-Chat",
|
||||
model_path="/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio-Chat",
|
||||
)
|
||||
|
||||
audio_in = (
|
||||
"https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav"
|
||||
)
|
||||
|
||||
# 1st dialogue turn
|
||||
prompt = "what does the person say?"
|
||||
cache = {"history": None}
|
||||
res = model.generate(input=audio_in, prompt=prompt, cache=cache)
|
||||
print(res)
|
||||
|
||||
|
||||
# 2nd dialogue turn
|
||||
prompt = 'Find the start time and end time of the word "middle classes"'
|
||||
res = model.generate(input=None, prompt=prompt, cache=cache)
|
||||
print(res)
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
|
||||
# MIT License (https://opensource.org/licenses/MIT)
|
||||
|
||||
# To install requirements: pip3 install -U "funasr[llm]"
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(
|
||||
model="Qwen-Audio",
|
||||
model_path="/nfs/zhifu.gzf/init_model/qwen/Qwen-Audio",
|
||||
)
|
||||
|
||||
audio_in = "https://github.com/QwenLM/Qwen-Audio/raw/main/assets/audio/1272-128104-0000.flac"
|
||||
prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"
|
||||
|
||||
res = model.generate(input=audio_in, prompt=prompt)
|
||||
print(res)
|
||||
Reference in New Issue
Block a user