mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
funasr1.0 streaming demo
This commit is contained in:
parent
247c763286
commit
0143122a4e
@ -22,10 +22,8 @@ print(res)
|
|||||||
import soundfile
|
import soundfile
|
||||||
import os
|
import os
|
||||||
|
|
||||||
speech, sample_rate = soundfile.read(os.path.expanduser('~')+
|
wav_file = os.path.join(model.model_path, "example/asr_example.wav")
|
||||||
"/.cache/modelscope/hub/damo/"+
|
speech, sample_rate = soundfile.read(wav_file)
|
||||||
"speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/"+
|
|
||||||
"example/asr_example.wav")
|
|
||||||
|
|
||||||
chunk_stride = chunk_size[1] * 960 # 600ms、480ms
|
chunk_stride = chunk_size[1] * 960 # 600ms、480ms
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ def prepare_data_iterator(data_in, input_len=None, data_type=None, key=None):
|
|||||||
|
|
||||||
return key_list, data_list
|
return key_list, data_list
|
||||||
|
|
||||||
@hydra.main(config_name=None)
|
@hydra.main(config_name=None, version_base=None)
|
||||||
def main_hydra(cfg: DictConfig):
|
def main_hydra(cfg: DictConfig):
|
||||||
def to_plain_list(cfg_item):
|
def to_plain_list(cfg_item):
|
||||||
if isinstance(cfg_item, ListConfig):
|
if isinstance(cfg_item, ListConfig):
|
||||||
@ -150,6 +150,7 @@ class AutoModel:
|
|||||||
self.punc_kwargs = punc_kwargs
|
self.punc_kwargs = punc_kwargs
|
||||||
self.spk_model = spk_model
|
self.spk_model = spk_model
|
||||||
self.spk_kwargs = spk_kwargs
|
self.spk_kwargs = spk_kwargs
|
||||||
|
self.model_path = kwargs["model_path"]
|
||||||
|
|
||||||
|
|
||||||
def build_model(self, **kwargs):
|
def build_model(self, **kwargs):
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
|
|||||||
from funasr.download.download_from_hub import download_model
|
from funasr.download.download_from_hub import download_model
|
||||||
from funasr.register import tables
|
from funasr.register import tables
|
||||||
|
|
||||||
@hydra.main(config_name=None)
|
@hydra.main(config_name=None, version_base=None)
|
||||||
def main_hydra(kwargs: DictConfig):
|
def main_hydra(kwargs: DictConfig):
|
||||||
if kwargs.get("debug", False):
|
if kwargs.get("debug", False):
|
||||||
import pdb; pdb.set_trace()
|
import pdb; pdb.set_trace()
|
||||||
|
|||||||
@ -18,6 +18,7 @@ def download_from_ms(**kwargs):
|
|||||||
model_revision = kwargs.get("model_revision")
|
model_revision = kwargs.get("model_revision")
|
||||||
if not os.path.exists(model_or_path):
|
if not os.path.exists(model_or_path):
|
||||||
model_or_path = get_or_download_model_dir(model_or_path, model_revision, is_training=kwargs.get("is_training"), check_latest=kwargs.get("kwargs", True))
|
model_or_path = get_or_download_model_dir(model_or_path, model_revision, is_training=kwargs.get("is_training"), check_latest=kwargs.get("kwargs", True))
|
||||||
|
kwargs["model_path"] = model_or_path
|
||||||
|
|
||||||
config = os.path.join(model_or_path, "config.yaml")
|
config = os.path.join(model_or_path, "config.yaml")
|
||||||
if os.path.exists(config) and os.path.exists(os.path.join(model_or_path, "model.pb")):
|
if os.path.exists(config) and os.path.exists(os.path.join(model_or_path, "model.pb")):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user