Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

install requirements automatically

游雁5942057698cc
diff --git a/funasr/download/download_from_hub.py b/funasr/download/download_from_hub.py
index f23be0dbb..46704b096 100644
--- a/funasr/download/download_from_hub.py
+++ b/funasr/download/download_from_hub.py
@@ -73,6 +73,8 @@ def download_from_ms(**kwargs):
if isinstance(kwargs, DictConfig):
kwargs = OmegaConf.to_container(kwargs, resolve=True)
if os.path.exists(os.path.join(model_or_path, "requirements.txt")):
+ requirements = os.path.join(model_or_path, "requirements.txt")
+ print(f"Detect model requirements, begin to install it: {requirements}")
from funasr.utils.install_model_requirements import install_requirements
install_requirements(os.path.join(model_or_path, "requirements.txt"))
return kwargs
diff --git a/funasr/frontends/whisper_frontend.py b/funasr/frontends/whisper_frontend.py
index 0598c61dc..dd61f8ea5 100644
--- a/funasr/frontends/whisper_frontend.py
+++ b/funasr/frontends/whisper_frontend.py
@@ -1,8 +1,8 @@
from typing import Tuple
import torch
import torch.nn as nn
-import whisper
-from whisper.audio import HOP_LENGTH, N_FFT, N_SAMPLES
+
+
from funasr.register import tables
from torch.nn.utils.rnn import pad_sequence
@@ -26,7 +26,8 @@ class WhisperFrontend(nn.Module):
super().__init__()
assert fs == 16000
self.fs = fs
-
+ import whisper
+ from whisper.audio import HOP_LENGTH, N_FFT, N_SAMPLES
self.n_fft = N_FFT
self.win_length = N_FFT
self.hop_length = HOP_LENGTH