fix(transcriber): закрыты находки ревью по module выполнения

- неявный compute_type при fallback переразрешается по умолчанию CPU
  (float16 CUDA не переносится на CTranslate2 CPU);
- prepare() помечает module готовым только после проверки пословного
  контракта;
- движок сообщает сам adapter (атрибут engine) вместо параллельной таблицы;
- сбой runtime_info() не роняет запуск;
- каскад конфига оставляет model/compute_type пустыми для module,
  CLI не дублирует CLI > TOML;
- удалены недостижимые из CLI сообщения о mid-stream fallback;
- в --verbose потоки помечены как запрошенные, adapters сообщают
  применённые; OpenVINO прямо говорит, что --threads не применяется;
- тесты: умолчания по устройствам, TOML compute_type, не-strict сценарий
  обычной ошибки; CONTRIBUTING.md и AGENTS.md без устаревших имён.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dmitry DementievandClaude Opus 5 committed 2026-09-22 00:32:04 +03:00
1 parent f7c0ed9a8c
commit 6f1064ccc4
15 files changed
+236 -104

No files matched your search

+10 -25
View File
@@ -343,13 +343,11 @@ def main(
diarize_enabled = defaults["diarize"] is True or speakers is not None
requested_device = defaults["device"]
# Явные model/compute_type; умолчания исполнения разрешает module.
# Умолчания model/compute_type зависят от устройства — их разрешает module.
request = ExecutionRequest(
device=requested_device,
model=model if model is not None else config.get("model"),
compute_type=(
compute_type if compute_type is not None else config.get("compute_type")
),
model=defaults["model"],
compute_type=defaults["compute_type"],
language=defaults["language"],
cpu_threads=threads,
require_word_timestamps=diarize_enabled,
@@ -427,7 +425,9 @@ def _print_execution_header(info: ExecutionInfo, verbose: bool) -> None:
)
if verbose:
threads = info.cpu_threads or "по умолчанию библиотеки"
console.print(f"Движок: {info.engine} Потоки: {threads}", style="dim")
console.print(
f"Движок: {info.engine} Потоки (запрошено): {threads}", style="dim"
)
for key, value in info.runtime.items():
console.print(f" {key}: {value}", style="dim", markup=False)
@@ -502,13 +502,6 @@ def _run_single(
if diarization_warning is not None:
console.print(f"Внимание: {diarization_warning}", style="yellow")
execution = transcriber.execution
if execution.device != info.device:
console.print(
f"Запрошено {execution.requested_device}, использовано {execution.device}",
style="yellow",
)
if len(result.segments) == 0:
message = f"Речь не обнаружена в файле {validated_file.name}"
if speaker_diarizer is not None:
@@ -520,8 +513,8 @@ def _run_single(
content = format_transcript(
result=result,
source_filename=validated_file.name,
model_name=execution.model,
device_info=execution.description,
model_name=info.model,
device_info=info.description,
language_mode=language_mode,
speaker_transcript=speaker_transcript,
diarization_warning=diarization_warning,
@@ -591,7 +584,6 @@ def _run_batch(
def on_segment(seg: Segment) -> None:
console.print(f" [{seg.start:.2f}s] {seg.text.strip()}")
device_before = transcriber.execution.device
with Status(f"{prefix}...", console=console) as status:
result = transcriber.transcribe(
file,
@@ -601,13 +593,6 @@ def _run_batch(
else lambda msg: console.print(msg),
)
execution = transcriber.execution
if execution.device != device_before:
console.print(
f" {file.name}: fallback на {execution.device} при транскрипции",
style="yellow",
)
language_mode = _format_language_mode(request.language or "auto", result)
speaker_transcript = None
diarization_warning = None
@@ -651,8 +636,8 @@ def _run_batch(
content = format_transcript(
result=result,
source_filename=file.name,
model_name=execution.model,
device_info=execution.description,
model_name=info.model,
device_info=info.description,
language_mode=language_mode,
speaker_transcript=speaker_transcript,
diarization_warning=diarization_warning,