Skip to content

Commit

Permalink
wav2vec2 backend + large + 6 workers.
Browse files Browse the repository at this point in the history
  • Loading branch information
boocmp committed Aug 19, 2024
1 parent 16e34c4 commit de9ca33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/runners/audio_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def add(self, word):
):
self.transcription += word.word


"""
class BatchableAudioTranscriber(bentoml.Runnable):
SUPPORTED_RESOURCES = ("nvidia.com/gpu", "cpu")
Expand Down Expand Up @@ -232,7 +231,6 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
for text in segments
]


"""
from transformers import WhisperProcessor, WhisperForConditionalGeneration
import torch
Expand Down Expand Up @@ -300,4 +298,4 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
)
for text in segments
]
"""
"""
4 changes: 3 additions & 1 deletion src/stt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def handleUpstream(
transciption = await runner_audio_transcriber.async_run(
[BatchInput(audio=mic_data, lang=lang, pair=pair)]
)
process_time = datetime.now() - process_time
process_time = (datetime.now() - process_time).total_seconds()

out = transciption[0]
print(
Expand All @@ -94,6 +94,7 @@ async def handleUpstream(
out.merge_audio_time
+ out.transcribe_time
+ out.restore_time,
process_time,
)
)
finally:
Expand Down Expand Up @@ -133,6 +134,7 @@ async def handleStream(pair):
"final": text.final,
"buffer": text.buffer_len,
"process_time": text.process_time,
"time": text.time,
}
)
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions src/utils/ipc/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Text(msgspec.Struct, tag=True):
final: bool
buffer_len: int = 0
process_time: float = 0
time: float = 0


Request = Publish | Subscribe | Ready | Text
Expand Down

0 comments on commit de9ca33

Please sign in to comment.