first commit for takway.ai
This commit is contained in:
commit
d7a6de771c
3256 files changed
+795173
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#!/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 openai-whisper
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(
|
||||
model="iic/Whisper-large-v3",
|
||||
vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch",
|
||||
vad_kwargs={"max_single_segment_time": 30000},
|
||||
)
|
||||
|
||||
DecodingOptions = {
|
||||
"task": "transcribe",
|
||||
"language": None,
|
||||
"beam_size": None,
|
||||
"fp16": True,
|
||||
"without_timestamps": False,
|
||||
"prompt": None,
|
||||
}
|
||||
res = model.generate(
|
||||
DecodingOptions=DecodingOptions,
|
||||
batch_size_s=0,
|
||||
input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav",
|
||||
)
|
||||
|
||||
print(res)
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/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 openai-whisper
|
||||
|
||||
from funasr import AutoModel
|
||||
|
||||
# model = AutoModel(model="Whisper-small", hub="openai")
|
||||
# model = AutoModel(model="Whisper-medium", hub="openai")
|
||||
# model = AutoModel(model="Whisper-large-v2", hub="openai")
|
||||
model = AutoModel(
|
||||
model="Whisper-large-v3",
|
||||
vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch",
|
||||
vad_kwargs={"max_single_segment_time": 30000},
|
||||
hub="openai",
|
||||
)
|
||||
|
||||
DecodingOptions = {
|
||||
"task": "transcribe",
|
||||
"language": None,
|
||||
"beam_size": None,
|
||||
"fp16": True,
|
||||
"without_timestamps": False,
|
||||
"prompt": None,
|
||||
}
|
||||
res = model.generate(
|
||||
DecodingOptions=DecodingOptions,
|
||||
batch_size_s=0,
|
||||
input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav",
|
||||
)
|
||||
|
||||
print(res)
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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 openai-whisper
|
||||
|
||||
# method1, inference from model hub
|
||||
|
||||
# for more input type, please ref to readme.md
|
||||
input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav"
|
||||
|
||||
output_dir="./outputs/debug"
|
||||
|
||||
model="iic/speech_whisper-large_asr_multilingual"
|
||||
|
||||
|
||||
device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu"
|
||||
|
||||
python -m funasr.bin.inference \
|
||||
++model=${model} \
|
||||
++input="${input}" \
|
||||
++output_dir="${output_dir}" \
|
||||
++device="${device}" \
|
||||
@@ -0,0 +1,42 @@
|
||||
# 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 openai-whisper
|
||||
|
||||
# method2, inference from local model
|
||||
|
||||
# for more input type, please ref to readme.md
|
||||
input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav"
|
||||
|
||||
output_dir="./outputs/debug"
|
||||
|
||||
workspace=`pwd`
|
||||
|
||||
# download model
|
||||
local_path_root=${workspace}/modelscope_models
|
||||
mkdir -p ${local_path_root}
|
||||
#Whisper-large-v2
|
||||
#local_path=${local_path_root}/speech_whisper-large_asr_multilingual
|
||||
#git clone https://www.modelscope.cn/iic/speech_whisper-large_asr_multilingual.git ${local_path}
|
||||
#init_param="${local_path}/large-v2.pt"
|
||||
#Whisper-large-v3
|
||||
local_path=${local_path_root}/Whisper-large-v3
|
||||
git clone https://www.modelscope.cn/iic/Whisper-large-v3.git ${local_path}
|
||||
init_param="${local_path}/large-v3.pt"
|
||||
|
||||
device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu"
|
||||
|
||||
config="config.yaml"
|
||||
|
||||
|
||||
python -m funasr.bin.inference \
|
||||
--config-path "${local_path}" \
|
||||
--config-name "${config}" \
|
||||
++init_param="${init_param}" \
|
||||
++input="${input}" \
|
||||
++output_dir="${output_dir}" \
|
||||
++device="${device}" \
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# 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 openai-whisper
|
||||
|
||||
# method1, inference from model hub
|
||||
|
||||
# for more input type, please ref to readme.md
|
||||
input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav"
|
||||
|
||||
output_dir="./outputs/debug"
|
||||
|
||||
#model="Whisper-small"
|
||||
#model="Whisper-medium"
|
||||
model="Whisper-large-v2"
|
||||
#model="Whisper-large-v3"
|
||||
hub="openai"
|
||||
|
||||
device="cuda:0" # "cuda:0" for gpu0, "cuda:1" for gpu1, "cpu"
|
||||
|
||||
python -m funasr.bin.inference \
|
||||
++model=${model} \
|
||||
++hub=${hub} \
|
||||
++input="${input}" \
|
||||
++output_dir="${output_dir}" \
|
||||
++device="${device}" \
|
||||
Reference in new issue
Block a user