Skip to content

Commit

Permalink
Merge pull request #75 from kadirnar/add-new-parameter
Browse files Browse the repository at this point in the history
🌞 Add more parameter support for Whisper pipeline
  • Loading branch information
kadirnar authored May 2, 2024
2 parents f94634c + 13497f0 commit 48eab1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ accelerate
pre-commit==3.4.0
autollm==0.1.9
speechbrain==0.5.16
bitsandbytes
flash-attn --no-build-isolation
15 changes: 11 additions & 4 deletions whisperplus/pipelines/whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ def load_model(self, model_id: str = "openai/whisper-large-v3"):
self.processor = processor
self.model = model

def __call__(self, audio_path: str, language: str = "turkish"):
def __call__(
self,
chunk_length_s: int = 30,
stride_length_s: int = 5,
audio_path: str = "test.mp3",
max_new_tokens: int = 128,
batch_size: int = 100,
language: str = "turkish"):
"""
Converts audio to text using the pre-trained speech recognition model.
Expand All @@ -61,9 +68,9 @@ def __call__(self, audio_path: str, language: str = "turkish"):
pipe = pipeline(
"automatic-speech-recognition",
model=self.model,
chunk_length_s=30,
stride_length_s=5,
max_new_tokens=128,
chunk_length_s=chunk_length_s,
stride_length_s=stride_length_s,
max_new_tokens=max_new_tokens,
batch_size=100,
device_map="auto",
return_timestamps=True,
Expand Down

0 comments on commit 48eab1f

Please sign in to comment.