Skip to content

Commit 60b96f5

Browse files
committed
format
1 parent 4f866c4 commit 60b96f5

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

amt/inference/transcribe.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def transcribe_file(
468468
logger.info(f"Finished segment (eos_tok): {file_path}")
469469
else:
470470
# This might need it's logic adjusted
471-
471+
472472
seq = _truncate_seq(
473473
seq,
474474
CHUNK_LEN_MS,
@@ -477,9 +477,7 @@ def transcribe_file(
477477
)
478478

479479
if len(seq) == 1:
480-
logger.error(
481-
f"Failed to transcribe segment: {file_path}"
482-
)
480+
logger.error(f"Failed to transcribe segment: {file_path}")
483481
if len(concat_seq) > 500:
484482
res.append(concat_seq)
485483
else:
@@ -594,17 +592,29 @@ def worker(
594592
while len(threads) < tasks_per_worker and not file_queue.empty():
595593
logging.info("Starting worker")
596594
file_path = file_queue.get()
597-
t = threading.Thread(target=process_file, args=(file_path, file_queue, gpu_task_queue, result_queue, tokenizer, save_dir, input_dir, logger))
595+
t = threading.Thread(
596+
target=process_file,
597+
args=(
598+
file_path,
599+
file_queue,
600+
gpu_task_queue,
601+
result_queue,
602+
tokenizer,
603+
save_dir,
604+
input_dir,
605+
logger,
606+
),
607+
)
598608
t.start()
599609
threads.append(t)
600-
610+
601611
threads = [t for t in threads if t.is_alive()]
602-
603-
time.sleep(0.1)
604-
612+
613+
time.sleep(0.1)
614+
605615
for t in threads:
606616
t.join()
607-
617+
608618
except Exception as e:
609619
logger.error(f"File worker failed with exception: {e}")
610620
finally:
@@ -650,7 +660,7 @@ def batch_transcribe(
650660
result_queue,
651661
save_dir,
652662
input_dir,
653-
# Wait for all threads to finish
663+
# Wait for all threads to finish
654664
4,
655665
),
656666
)

0 commit comments

Comments
 (0)