Skip to content

Commit

Permalink
wav2vec2 backend + large + 8 workers.
Browse files Browse the repository at this point in the history
  • Loading branch information
boocmp committed Aug 19, 2024
1 parent 07ac8b6 commit 16e34c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ runners:
resources:
cpu: 4
nvidia.com/gpu: 1
workers_per_resource: 8
workers_per_resource: 6
12 changes: 7 additions & 5 deletions src/runners/audio_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
"""

"""
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor, WhisperProcessor,

from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import torch
from itertools import groupby

Expand All @@ -180,10 +180,10 @@ class BatchableAudioTranscriber(bentoml.Runnable):
def __init__(self):
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.processor = Wav2Vec2Processor.from_pretrained(
"facebook/wav2vec2-base-960h"
"facebook/wav2vec2-large-960h-lv60-self"
)
self.model = Wav2Vec2ForCTC.from_pretrained(
"facebook/wav2vec2-base-960h"
"facebook/wav2vec2-large-960h-lv60-self"
).cuda()

def transcribe(self, audios):
Expand Down Expand Up @@ -231,8 +231,9 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
)
for text in segments
]
"""


"""
from transformers import WhisperProcessor, WhisperForConditionalGeneration
import torch
Expand Down Expand Up @@ -299,3 +300,4 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
)
for text in segments
]
"""

0 comments on commit 16e34c4

Please sign in to comment.