Spaces:
Sleeping
Sleeping
Manjot Singh
commited on
Commit
·
706f640
1
Parent(s):
dde6042
changed gpu compute type
Browse files- audio_processing.py +2 -2
audio_processing.py
CHANGED
@@ -39,7 +39,7 @@ def process_audio(audio_file, translate=False, model_size="small"):
|
|
39 |
try:
|
40 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
41 |
print(f"Using device: {device}")
|
42 |
-
compute_type =
|
43 |
audio = whisperx.load_audio(audio_file)
|
44 |
model = whisperx.load_model(model_size, device, compute_type=compute_type)
|
45 |
|
@@ -53,7 +53,7 @@ def process_audio(audio_file, translate=False, model_size="small"):
|
|
53 |
language_segments = []
|
54 |
final_segments = []
|
55 |
|
56 |
-
overlap_duration =
|
57 |
for i, chunk in enumerate(chunks):
|
58 |
chunk_start_time = i * (CHUNK_LENGTH - overlap_duration)
|
59 |
chunk_end_time = chunk_start_time + CHUNK_LENGTH
|
|
|
39 |
try:
|
40 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
41 |
print(f"Using device: {device}")
|
42 |
+
compute_type = "int8" if torch.cuda.is_available() else "float32"
|
43 |
audio = whisperx.load_audio(audio_file)
|
44 |
model = whisperx.load_model(model_size, device, compute_type=compute_type)
|
45 |
|
|
|
53 |
language_segments = []
|
54 |
final_segments = []
|
55 |
|
56 |
+
overlap_duration = OVERLAP # 2 seconds overlap
|
57 |
for i, chunk in enumerate(chunks):
|
58 |
chunk_start_time = i * (CHUNK_LENGTH - overlap_duration)
|
59 |
chunk_end_time = chunk_start_time + CHUNK_LENGTH
|