Skip to content

Commit

Permalink
float16 compute type.
Browse files Browse the repository at this point in the history
  • Loading branch information
boocmp committed Aug 14, 2024
1 parent 08610b4 commit a680d72
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/runners/audio_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ class BatchableAudioTranscriber(bentoml.Runnable):

def __init__(self):
self.device = "cuda" if ctranslate2.get_cuda_device_count() > 0 else "cpu"
compute_type = (
"int8_float16" if ctranslate2.get_cuda_device_count() > 0 else "int8"
)
compute_type = "float16" if ctranslate2.get_cuda_device_count() > 0 else "int8"

print(self.device, " ", compute_type)

Expand All @@ -142,13 +140,7 @@ def __init__(self):
)

def transcribe(self, audios):
result = self.model.transcribe(
audios,
batch_size=10,
language="en",
print_progress=True,
combined_progress=True,
)
result = self.model.transcribe(audios, batch_size=10, language="en")
return result["segments"]

@bentoml.Runnable.method(batchable=True)
Expand All @@ -174,10 +166,7 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]:
segments = self.transcribe(audio_batch)

result = []
print("inputs ", len(inputs))
for segment in segments:
print(segment)

if segment["start"] + 0.1 >= 30 * len(result):
result.append("")
if segment["end"] < 30 * (len(result)):
Expand Down

0 comments on commit a680d72

Please sign in to comment.