Skip to content

Commit

Permalink
chore: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
chidiwilliams committed Jan 6, 2024
1 parent ea40f24 commit c963124
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 275 deletions.
5 changes: 3 additions & 2 deletions buzz/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
from dataclasses_json import dataclass_json, config, Exclude

from buzz.model_loader import whisper_cpp
from . import transformers_whisper, whisper_audio
from . import whisper_audio
from .conn import pipe_stderr
from .locale import _
from .model_loader import TranscriptionModel, ModelType
from .transformers_whisper import TransformersWhisper

if sys.platform != "linux":
import faster_whisper
Expand Down Expand Up @@ -578,7 +579,7 @@ def transcribe_whisper(

@classmethod
def transcribe_hugging_face(cls, task: FileTranscriptionTask) -> List[Segment]:
model = transformers_whisper.load_model(task.model_path)
model = TransformersWhisper(task.model_path)
language = (
task.transcription_options.language
if task.transcription_options.language is not None
Expand Down
14 changes: 3 additions & 11 deletions buzz/transformers_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,10 @@
from transformers import WhisperProcessor, WhisperForConditionalGeneration


def load_model(model_name_or_path: str):
processor = WhisperProcessor.from_pretrained(model_name_or_path)
model = WhisperForConditionalGeneration.from_pretrained(model_name_or_path)
return TransformersWhisper(processor, model)


class TransformersWhisper:
def __init__(
self, processor: WhisperProcessor, model: WhisperForConditionalGeneration
):
self.processor = processor
self.model = model
def __init__(self, model_name_or_path: str):
self.processor = WhisperProcessor.from_pretrained(model_name_or_path)
self.model = WhisperForConditionalGeneration.from_pretrained(model_name_or_path)
self.SAMPLE_RATE = whisper.audio.SAMPLE_RATE
self.N_SAMPLES_IN_CHUNK = whisper.audio.N_SAMPLES

Expand Down
Loading

0 comments on commit c963124

Please sign in to comment.