Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions funasr/models/fun_asr_nano/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from funasr.utils.load_utils import extract_fbank, load_audio_text_image_video
from transformers import AutoConfig, AutoModelForCausalLM

from ctc import CTC
from tools.utils import forced_align
from .ctc import CTC
from .tools.utils import forced_align

dtype_map = {"bf16": torch.bfloat16, "fp16": torch.float16, "fp32": torch.float32}

Expand Down
5 changes: 1 addition & 4 deletions funasr/tokenizer/whisper_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ def WhisperTokenizer(**kwargs):

@tables.register("tokenizer_classes", "SenseVoiceTokenizer")
def SenseVoiceTokenizer(**kwargs):
try:
from funasr.models.sense_voice.whisper_lib.tokenizer import get_tokenizer
except:
print("Notice: If you want to use whisper, please `pip install -U openai-whisper`")
from funasr.models.sense_voice.whisper_lib.tokenizer import get_tokenizer

language = kwargs.get("language", None)
task = kwargs.get("task", None)
Comment on lines +27 to 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing the try-except block without a clear alternative for handling the import error could lead to runtime exceptions if the openai-whisper package is not installed. Consider adding a check for the dependency and raising a more informative error, or lazily importing the dependency only when the SenseVoiceTokenizer is actually used.

If the intention is to always require openai-whisper when using SenseVoiceTokenizer, then this change is acceptable, but it should be documented.

from funasr.models.sense_voice.whisper_lib.tokenizer import get_tokenizer


language = kwargs.get("language", None)
task = kwargs.get("task", None)

Expand Down