Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
add mossformer code
haoneng.lhnb1e980d501f0
diff --git a/funasr/bin/ss_inference_launch.py b/funasr/bin/ss_inference_launch.pyindex bab68ad98..64503a0a5 100644--- a/funasr/bin/ss_inference_launch.py+++ b/funasr/bin/ss_inference_launch.py@@ -104,7 +104,7 @@ def inference_ss(ss_results = speech_separator(**batch)for spk in range(num_spks):- sf.write(os.path.join(output_path, keys[0].replace('.wav', '_s'+str(spk+1)+'.wav')), ss_results[spk], sample_rate)+ sf.write(os.path.join(output_path, keys[0] + '_s' + str(spk+1)+'.wav'), ss_results[spk], sample_rate)torch.cuda.empty_cache()return ss_resultsdiff --git a/funasr/build_utils/build_model_from_file.py b/funasr/build_utils/build_model_from_file.pyindex 6130e7114..65e0d5f61 100644--- a/funasr/build_utils/build_model_from_file.py+++ b/funasr/build_utils/build_model_from_file.py@@ -11,18 +11,6 @@ from funasr.build_utils.build_model import build_modelfrom funasr.models.base_model import FunASRModel-def load_checkpoint(checkpoint_path, use_cuda=1):- if use_cuda:- checkpoint = torch.load(checkpoint_path)- else:- checkpoint = torch.load(- checkpoint_path, map_location=lambda storage, loc: storage)- return checkpoint--def reload_ss_for_eval(model, checkpoint_path, use_cuda=False):- checkpoint = load_checkpoint(checkpoint_path, use_cuda)- model.load_state_dict(checkpoint['model'], strict=False)-def build_model_from_file(config_file: Union[Path, str] = None,model_file: Union[Path, str] = None,@@ -82,9 +70,8 @@ def build_model_from_file(model.load_state_dict(model_dict)else:model_dict = torch.load(model_file, map_location=device)- if task_name == 'ss':- reload_ss_for_eval(model, model_file, use_cuda=True)- logging.info("model is loaded from path: {}".format(model_file))+ if task_name == "ss":+ model_dict = model_dict['model']if task_name == "diar" and mode == "sond":model_dict = fileter_model_dict(model_dict, model.state_dict())if task_name == "vad":