#!/bin/zsh set -eu umask 077 : "${LAB:?runner must set LAB}" : "${HOME:?runner must set HOME}" : "${RESULTS:?runner must set RESULTS}" mkdir -p "$LAB/inputs" "$LAB/logs" "$LAB/cache" "$RESULTS/records" export HF_HUB_OFFLINE=1 export HF_DATASETS_OFFLINE=1 export HF_HUB_DISABLE_TELEMETRY=1 export HF_HOME="$LAB/cache/huggingface" export XDG_CACHE_HOME="$LAB/cache" export NUMBA_CACHE_DIR="$LAB/cache/numba" export MPLCONFIGDIR="$LAB/cache/matplotlib" export OMP_NUM_THREADS=8 export OPENBLAS_NUM_THREADS=8 export VECLIB_MAXIMUM_THREADS=8 export TOKENIZERS_PARALLELISM=false export PYTHONHASHSEED=0 cat > "$LAB/measure.py" <<'PY' import csv import hashlib import importlib.metadata import io import json import os from pathlib import Path import re import statistics import sys import time import unicodedata LAB = Path(os.environ["LAB"]) RESULTS = Path(os.environ["RESULTS"]) RATE = 16000 SEED = 20261110 ARMS = ("baseline", "vad05", "vad08") GROUPS = ("clean", "pause", "quiet", "quiet_noise", "no_speech") MODEL_REVISION = "a4aaeec0636e6fef84abdcbe3544cb2bf7e9f6fb" DATA_REVISION = "8d6448449ef85cacf10301f85c215be519e08061" def write_json(relative, value): payload = json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n" if len(payload.encode("utf-8")) >= 512 * 1024: raise ValueError("Result exceeds text-file limit: " + relative) target = RESULTS / relative target.parent.mkdir(parents=True, exist_ok=True) target.write_text(payload, encoding="utf-8") def safe_error(exc): message = str(exc) for key in ("RESULTS", "LAB", "HOME", "TMPDIR"): value = os.environ.get(key) if value: message = message.replace(value, "") message = re.sub(r"/(?:Users|private|var|opt|usr)/[^\s\"']+", "", message) return {"type": type(exc).__name__, "message": message[:2000]} def normalize(text, punctuation=True): text = unicodedata.normalize("NFKC", text).casefold() return "".join(c for c in text if not c.isspace() and (not punctuation or unicodedata.category(c)[0] not in ("P", "Z"))) def edit_counts(reference, hypothesis): # Unit-cost Levenshtein. Ties prefer diagonal, deletion, then insertion. # Counts are (total, substitutions, deletions, insertions). previous = [(j, 0, 0, j) for j in range(len(hypothesis) + 1)] for i, ref_char in enumerate(reference, 1): current = [(i, 0, i, 0)] for j, hyp_char in enumerate(hypothesis, 1): d = previous[j - 1] diagonal = d if ref_char == hyp_char else (d[0] + 1, d[1] + 1, d[2], d[3]) d = previous[j] deletion = (d[0] + 1, d[1], d[2] + 1, d[3]) d = current[j - 1] insertion = (d[0] + 1, d[1], d[2], d[3] + 1) current.append(min((diagonal, deletion, insertion), key=lambda v: v[0])) previous = current total, substitutions, deletions, insertions = previous[-1] n = len(reference) return {"S": substitutions, "D": deletions, "I": insertions, "N": n, "errors": total, "cer": total / n if n else None} def digest_pcm(audio): return hashlib.sha256(audio.astype("= 6 or reference in seen: continue chosen.append(row) seen.add(reference) gender_counts[gender] += 1 if len(chosen) == 12: break if gender_counts != {0: 6, 1: 6}: raise RuntimeError("Predeclared 12-utterance sample unavailable") warm = next((r for r in eligible if normalize(r["reference"]) not in seen), None) if warm is None: raise RuntimeError("No separate warmup utterance") # Read the embedded public audio bytes, never the dataset's original filesystem paths. audio_column = pf.read(columns=["audio"]) cases, sources = [], [] def decode(row): entry = audio_column.slice(row["row_index"], 1).to_pylist()[0]["audio"] if not isinstance(entry, dict) or not entry.get("bytes"): raise RuntimeError("Embedded audio bytes missing") audio, rate = sf.read(io.BytesIO(entry["bytes"]), dtype="float32") if rate != RATE or audio.ndim != 1 or len(audio) != row["num_samples"]: raise RuntimeError("Unexpected audio rate, channels or length") if not np.isfinite(audio).all() or float(np.max(np.abs(audio))) > 1.001: raise RuntimeError("Invalid waveform") if float(np.sqrt(np.mean(audio.astype("float64") ** 2))) <= 0: raise RuntimeError("Silent source utterance") return audio def save(case_id, audio, condition, source_id, reference, original_seconds, added_silence, processing): np.save(LAB / "inputs" / (case_id + ".npy"), audio, allow_pickle=False) cases.append({"case_id": case_id, "condition": condition, "source_id": source_id, "reference": reference, "input_seconds": len(audio) / RATE, "original_seconds": original_seconds, "pcm_sha256": digest_pcm(audio), "known_added_non_speech_intervals": added_silence, "processing": processing}) for index, row in enumerate(chosen): original = decode(row) source_id = f"u{index:02d}" seconds = len(original) / RATE sources.append({"source_id": source_id, "fleurs_id": row["id"], "parquet_row": row["row_index"], "gender_label": row["gender"], "reference": row["reference"], "dataset_transcription": row["transcription"], "seconds": seconds, "pcm_sha256": digest_pcm(original)}) save(source_id + "-clean", original, "clean", source_id, row["reference"], seconds, [], {"mode": "original"}) padded = np.concatenate((np.zeros(5 * RATE, dtype="float32"), original, np.zeros(25 * RATE, dtype="float32"))) blank = [[0, 5], [5 + seconds, 30 + seconds]] save(source_id + "-pause", padded, "pause", source_id, row["reference"], seconds, blank, {"leading_silence_seconds": 5, "trailing_silence_seconds": 25}) gain = 10 ** (-24 / 20) quiet_only = (padded * gain).astype("float32") save(source_id + "-quiet", quiet_only, "quiet", source_id, row["reference"], seconds, blank, {"speech_gain_db": -24, "noise": "none_added", "leading_seconds": 5, "trailing_seconds": 25}) speech_rms = float(np.sqrt(np.mean(original.astype("float64") ** 2))) * gain noise_rms = speech_rms / (10 ** (6 / 20)) rng = np.random.default_rng(SEED + row["row_index"]) noise = rng.standard_normal(len(padded)) noise *= noise_rms / float(np.sqrt(np.mean(noise ** 2))) quiet = (padded * gain + noise).astype("float32") save(source_id + "-quiet_noise", quiet, "quiet_noise", source_id, row["reference"], seconds, blank, {"speech_gain_db": -24, "snr_db": 6, "noise_rms": noise_rms, "seed": SEED + row["row_index"], "leading_seconds": 5, "trailing_seconds": 25, "noise": "synthetic_white"}) for seconds in (10, 35): save(f"zero-{seconds}", np.zeros(seconds * RATE, dtype="float32"), "no_speech", None, "", 0, [[0, seconds]], {"kind": "digital_silence"}) for db in (-50, -35): seed = SEED + seconds * 100 + abs(db) noise = np.random.default_rng(seed).standard_normal(seconds * RATE) noise *= (10 ** (db / 20)) / float(np.sqrt(np.mean(noise ** 2))) save(f"noise{abs(db)}-{seconds}", noise.astype("float32"), "no_speech", None, "", 0, [[0, seconds]], {"kind": "synthetic_white", "rms_dbfs": db, "seed": seed}) warm_audio = decode(warm) np.save(LAB / "inputs/warmup.npy", warm_audio, allow_pickle=False) if len(cases) != 54: raise RuntimeError("Incorrect predeclared case count") timing_cases = [c["case_id"] for c in cases if c["source_id"] in ("u00", "u01") and c["condition"] in ("pause", "quiet_noise")] manifest = { "dataset": "Google FLEURS ja_jp test", "revision": DATA_REVISION, "source_url": "https://huggingface.co/datasets/google/fleurs/tree/" + DATA_REVISION, "license": "CC BY 4.0", "attribution": "Conneau et al., FLEURS: Few-shot Learning Evaluation of Universal " "Representations of Speech (2022), https://arxiv.org/abs/2205.12446", "modifications": "Added silence, reduced amplitude and synthetic white noise as itemized.", "selection": "SHA256(id:row) order; 4-15s; 20-140 normalized chars; " "6 recordings each gender label 0/1; unique reference sentences.", "sources": sources, "cases": cases, "timing_case_ids": timing_cases, "warmup": {"fleurs_id": warm["id"], "parquet_row": warm["row_index"], "seconds": len(warm_audio) / RATE, "pcm_sha256": digest_pcm(warm_audio)}, "quality_inferences": 162, "additional_timing_inferences": 24, "limitations": ["Read speech, not real meetings.", "Speaker identities unavailable.", "Synthetic conditions are paired manipulations, not independent recordings.", "Reduced amplitude does not reproduce soft-spoken or whispered phonation.", "Potential training-set overlap unknown."]} write_json("inputs.json", manifest) versions = {} for line in (LAB / "requirements.txt").read_text().splitlines(): name, expected = line.split()[0].split("==") actual = importlib.metadata.version(name) if actual != expected: raise RuntimeError("Installed version mismatch: " + name) versions[name] = actual write_json("environment.json", { "machine": "Apple M6・メモリー24GBのMac mini", "python": sys.version.split()[0], "packages": versions, "model": "mlx-community/whisper-large-v3-turbo", "model_revision": MODEL_REVISION, "execution_network": "disabled by runner", "cpu_thread_limit": 8, "vad_cpu_threads": 1, "timing_order": list(ARMS), "timing_caveat": "Per-process first call is not a system cold boot; OS file cache " "and thermal conditions can differ across sequential arms."}) def arm(name): import numpy as np import torch import mlx.core as mx import mlx_whisper torch.set_num_threads(1) mx.set_default_device(mx.gpu) mx.random.seed(SEED) manifest = json.loads((RESULTS / "inputs.json").read_text()) threshold = {"baseline": None, "vad05": 0.5, "vad08": 0.8}[name] params = dict(path_or_hf_repo=str(LAB / "model"), language="ja", task="transcribe", temperature=0.0, condition_on_previous_text=False, initial_prompt=None, word_timestamps=False, no_speech_threshold=0.6, logprob_threshold=-1.0, compression_ratio_threshold=2.4, sample_len=224, fp16=True, verbose=None) initial_start = time.perf_counter() vad_model = None if threshold is not None: from silero_vad import load_silero_vad, get_speech_timestamps vad_model = load_silero_vad(onnx=True) warm = np.load(LAB / "inputs/warmup.npy", allow_pickle=False) first = mlx_whisper.transcribe(warm, **params) mx.synchronize() write_json(f"initial-{name}.json", { "arm": name, "seconds_including_vad_and_asr_initialization": time.perf_counter() - initial_start, "input_seconds": len(warm) / RATE, "text": first["text"], "excluded_from_quality_and_steady_timing": True}) def one(case, repeat): audio = np.load(LAB / "inputs" / (case["case_id"] + ".npy"), allow_pickle=False) if digest_pcm(audio) != case["pcm_sha256"]: raise RuntimeError("Input waveform hash changed") record = {"arm": name, "case_id": case["case_id"], "condition": case["condition"], "source_id": case["source_id"], "repeat": repeat, "reference": case["reference"], "input_seconds": case["input_seconds"], "original_seconds": case["original_seconds"], "vad_threshold": threshold, "status": "running"} target = f'records/{name}-{case["case_id"]}-r{repeat}.json' start = time.perf_counter() try: vad_start = time.perf_counter() if vad_model is None: regions = [{"start": 0, "end": len(audio)}] else: regions = get_speech_timestamps( torch.from_numpy(audio), vad_model, threshold=threshold, sampling_rate=RATE, min_speech_duration_ms=250, min_silence_duration_ms=500, speech_pad_ms=200, max_speech_duration_s=20, return_seconds=False) vad_seconds = time.perf_counter() - vad_start texts, segments = [], [] asr_start = time.perf_counter() for region in regions: left, right = int(region["start"]), int(region["end"]) if not (0 <= left < right <= len(audio)): raise RuntimeError("Invalid VAD interval") output = mlx_whisper.transcribe(audio[left:right], **params) texts.append(output["text"]) for segment in output["segments"]: segments.append({ "start": float(segment["start"]) + left / RATE, "end": float(segment["end"]) + left / RATE, "text": segment["text"], "avg_logprob": float(segment["avg_logprob"]), "no_speech_prob": float(segment["no_speech_prob"])}) mx.synchronize() asr_seconds = time.perf_counter() - asr_start elapsed = time.perf_counter() - start text = "".join(texts) counts = edit_counts(normalize(case["reference"]), normalize(text)) raw_counts = edit_counts(normalize(case["reference"], False), normalize(text, False)) attributed = sum( len(normalize(s["text"])) for s in segments if any(s["start"] >= a + 0.1 and s["end"] <= b - 0.1 for a, b in case["known_added_non_speech_intervals"])) peak_fn = getattr(mx, "get_peak_memory", None) record.update({ "status": "ok", "text": text, "normalized_text": normalize(text), "counts": counts, "punctuation_preserved_counts": raw_counts, "segments": segments, "vad_regions_seconds": [{"start": int(r["start"]) / RATE, "end": int(r["end"]) / RATE} for r in regions], "region_count": len(regions), "retained_seconds": sum(int(r["end"]) - int(r["start"]) for r in regions) / RATE, "elapsed_seconds": elapsed, "vad_seconds": vad_seconds, "asr_seconds": asr_seconds, "rtf_file_duration": elapsed / case["input_seconds"], "rtf_original_duration": elapsed / case["original_seconds"] if case["original_seconds"] else None, "empty_output_with_reference": bool(counts["N"] and not normalize(text)), "no_speech_output_chars": len(normalize(text)) if not counts["N"] else 0, "gap_timestamp_attributed_chars_diagnostic_only": attributed, "mlx_process_peak_bytes_so_far": int(peak_fn()) if peak_fn else None}) write_json(target, record) print(name, case["case_id"], repeat, "ok", flush=True) except Exception as exc: record.update(status="failed", elapsed_seconds=time.perf_counter() - start, error=safe_error(exc)) write_json(target, record) raise for case in manifest["cases"]: one(case, 0) lookup = {case["case_id"]: case for case in manifest["cases"]} for repeat in (1, 2): for case_id in manifest["timing_case_ids"]: one(lookup[case_id], repeat) def resources(name, exit_code): text = (LAB / "logs" / (name + "-time.txt")).read_text(errors="replace") rss = re.search(r"(\d+)\s+maximum resident set size", text) real = re.search(r"([\d.]+)\s+real\s+([\d.]+)\s+user\s+([\d.]+)\s+sys", text) value = {"arm": name, "exit_code": exit_code, "maximum_rss_bytes": int(rss.group(1)) if rss else None, "rss_source": "/usr/bin/time -l (macOS bytes)", "process_wall_seconds": float(real.group(1)) if real else None} if exit_code: value["error_tail"] = safe_error(RuntimeError(text[-2000:]))["message"] write_json(f"resources-{name}.json", value) def summary(): manifest = json.loads((RESULTS / "inputs.json").read_text()) records = [json.loads(p.read_text()) for p in sorted((RESULTS / "records").glob("*.json"))] ok = [r for r in records if r["status"] == "ok"] primary = [r for r in ok if r["repeat"] == 0] expected = {(arm_name, c["case_id"], repeat) for arm_name in ARMS for c in manifest["cases"] for repeat in ((0, 1, 2) if c["case_id"] in manifest["timing_case_ids"] else (0,))} actual = {(r["arm"], r["case_id"], r["repeat"]) for r in ok} resource_data = {} for name in ARMS: path = RESULTS / f"resources-{name}.json" if path.exists(): resource_data[name] = json.loads(path.read_text()) complete = (actual == expected and len(records) == len(expected) and len(resource_data) == 3 and all(r["exit_code"] == 0 and r["maximum_rss_bytes"] is not None for r in resource_data.values())) aggregated, timing, comparisons = {}, {}, [] by_key = {(r["arm"], r["case_id"]): r for r in primary} for name in ARMS: aggregated[name] = {} timing[name] = {} for condition in GROUPS: rows = [r for r in primary if r["arm"] == name and r["condition"] == condition] n = sum(r["counts"]["N"] for r in rows) counts = {k: sum(r["counts"][k] for r in rows) for k in ("S", "D", "I")} seconds = sum(r["elapsed_seconds"] for r in rows) full_duration = sum(r["input_seconds"] for r in rows) aggregated[name][condition] = { "n_cases": len(rows), **counts, "N": n, "cer": sum(counts.values()) / n if n else None, "deletion_rate": counts["D"] / n if n else None, "insertion_rate": counts["I"] / n if n else None, "cases_with_cer_at_most_30pct": sum(r["counts"]["N"] > 0 and 100 * r["counts"]["errors"] <= 30 * r["counts"]["N"] for r in rows), "empty_with_reference": sum(r["empty_output_with_reference"] for r in rows), "false_output_conditions": sum(r["no_speech_output_chars"] > 0 for r in rows), "false_output_chars": sum(r["no_speech_output_chars"] for r in rows), "total_seconds": seconds, "input_seconds": full_duration, "total_vad_seconds": sum(r["vad_seconds"] for r in rows), "retained_seconds": sum(r["retained_seconds"] for r in rows), "rtf_file_duration": seconds / full_duration if full_duration else None} for case_id in manifest["timing_case_ids"]: rows = [r for r in ok if r["arm"] == name and r["case_id"] == case_id] times = [r["elapsed_seconds"] for r in rows] if times: timing[name][case_id] = {"repetitions": len(times), "median_seconds": statistics.median(times), "min_seconds": min(times), "max_seconds": max(times), "distinct_outputs": len({r["text"] for r in rows})} decisions, condition_contrasts = {}, [] if complete: for name in ARMS: for source_condition, target_condition in (("pause", "quiet"), ("quiet", "quiet_noise")): b, a = aggregated[name][source_condition], aggregated[name][target_condition] paired = [(by_key[(name, f'{s["source_id"]}-{source_condition}')], by_key[(name, f'{s["source_id"]}-{target_condition}')]) for s in manifest["sources"]] condition_contrasts.append({ "arm": name, "from_condition": source_condition, "to_condition": target_condition, "n_cases": len(paired), "cer_delta_pp": 100 * (a["cer"] - b["cer"]), "deletion_delta_pp": 100 * (a["deletion_rate"] - b["deletion_rate"]), "insertion_delta_pp": 100 * (a["insertion_rate"] - b["insertion_rate"]), "new_empty_outputs": sum(not br["empty_output_with_reference"] and ar["empty_output_with_reference"] for br, ar in paired)}) for name in ("vad05", "vad08"): for condition in GROUPS: b, a = aggregated["baseline"][condition], aggregated[name][condition] case_ids = [c["case_id"] for c in manifest["cases"] if c["condition"] == condition] paired = [(by_key[("baseline", cid)], by_key[(name, cid)]) for cid in case_ids] comparisons.append({ "arm": name, "condition": condition, "n_cases": len(paired), "cer_delta_pp": 100 * (a["cer"] - b["cer"]) if a["N"] else None, "deletion_delta_pp": 100 * (a["deletion_rate"] - b["deletion_rate"]) if a["N"] else None, "elapsed_ratio": a["total_seconds"] / b["total_seconds"], "new_empty_outputs": sum(not br["empty_output_with_reference"] and ar["empty_output_with_reference"] for br, ar in paired), "improved_cases": sum(ar["counts"]["errors"] < br["counts"]["errors"] for br, ar in paired), "tied_cases": sum(ar["counts"]["errors"] == br["counts"]["errors"] for br, ar in paired), "worsened_cases": sum(ar["counts"]["errors"] > br["counts"]["errors"] for br, ar in paired), "false_output_conditions": a["false_output_conditions"], "false_output_chars": a["false_output_chars"]}) d = {r["condition"]: r for r in comparisons if r["arm"] == name} b, a = aggregated["baseline"]["no_speech"], aggregated[name]["no_speech"] observed = b["false_output_conditions"] >= 2 reduction = (a["false_output_conditions"] <= b["false_output_conditions"] * 0.5 and a["false_output_chars"] <= b["false_output_chars"] * 0.2) if observed else None clean_pause_checks = {} for condition in ("clean", "pause"): b, a = aggregated["baseline"][condition], aggregated[name][condition] base_errors = sum(b[k] for k in ("S", "D", "I")) vad_errors = sum(a[k] for k in ("S", "D", "I")) same_reference = a["N"] == b["N"] and b["N"] > 0 # CER gains from fewer insertions must not hide deletion or whole-utterance loss. # Integer comparisons keep both predeclared 1 pp boundaries exact. checks = { "cer_degradation_within_1pp": same_reference and 100 * (vad_errors - base_errors) <= b["N"], "deletion_degradation_within_1pp": same_reference and 100 * (a["D"] - b["D"]) <= b["N"], "no_new_empty_outputs": d[condition]["new_empty_outputs"] == 0} checks["limits_met"] = all(checks.values()) clean_pause_checks[condition] = checks quiet_checks = {} for condition in ("quiet", "quiet_noise"): b, a = aggregated["baseline"][condition], aggregated[name][condition] base_errors = sum(b[k] for k in ("S", "D", "I")) vad_errors = sum(a[k] for k in ("S", "D", "I")) same_reference = a["N"] == b["N"] and b["N"] > 0 # Integer comparisons keep the predeclared 2 pp / 30% boundaries exact. checks = { "baseline_quality_sufficient": (b["n_cases"] == 12 and b["N"] > 0 and 100 * base_errors <= 30 * b["N"] and b["cases_with_cer_at_most_30pct"] >= 10 and b["empty_with_reference"] == 0), "vad_quality_sufficient": (a["n_cases"] == 12 and a["N"] > 0 and 100 * vad_errors <= 30 * a["N"] and a["cases_with_cer_at_most_30pct"] >= 10 and a["empty_with_reference"] == 0), "cer_degradation_within_2pp": same_reference and 100 * (vad_errors - base_errors) <= 2 * b["N"], "deletion_degradation_within_2pp": same_reference and 100 * (a["D"] - b["D"]) <= 2 * b["N"], "no_new_empty_outputs": d[condition]["new_empty_outputs"] == 0} checks["retention_demonstrated"] = all(checks.values()) quiet_checks[condition] = checks speech_safe = (all(c["limits_met"] for c in clean_pause_checks.values()) and all(c["retention_demonstrated"] for c in quiet_checks.values())) repeat_pause_ids = [cid for cid in manifest["timing_case_ids"] if cid.endswith("-pause")] speed = (d["pause"]["elapsed_ratio"] <= 0.8 and all( timing[name][cid]["median_seconds"] <= 0.8 * timing["baseline"][cid]["median_seconds"] for cid in repeat_pause_ids)) decisions[name] = {"speech_quality_limits_met": speech_safe, "clean_pause_condition_checks": clean_pause_checks, "quiet_condition_checks": quiet_checks, "baseline_false_output_sufficient_to_test_reduction": observed, "false_output_reduction_limits_met": reduction, "pause_speed_limits_met": speed, "all_adoption_limits_met": speech_safe and reduction is True and speed} report = {"status": "complete" if complete else "incomplete", "expected_records": len(expected), "successful_records": len(ok), "failed_records": len(records) - len(ok), "quality_records": len(primary), "groups": aggregated, "paired_comparisons": comparisons, "within_arm_condition_contrasts": condition_contrasts, "timing_repetitions": timing, "resources": resource_data, "predeclared_checks": decisions, "interpretation": "Checks describe this fixed experiment, not an automatic publication decision. " "Do not call insertion errors hallucinations without checking the raw output. " "A null reduction means insufficient baseline false outputs, not success. " "Clean and pause must each stay within 1 pp CER and deletion degradation " "with no new empty outputs; fewer insertions cannot offset these limits. " "Quiet retention requires sufficient absolute quality in both baseline and VAD; " "a failed baseline quality floor is not evidence of retention. " "Quiet and quiet_noise must pass independently."} write_json("summary.json", report) if comparisons: with (RESULTS / "comparison.csv").open("w", encoding="utf-8", newline="") as handle: writer = csv.DictWriter(handle, fieldnames=list(comparisons[0])) writer.writeheader() writer.writerows(comparisons) readme = [ "# 実験結果の読み方", "", "状態: " + report["status"], "品質評価は同じ12文の加工条件の対応比較です。速度の反復を精度標本数へ加えません。", "inputs.jsonに参照文、データの出典、加工、固定seed、音声ハッシュがあります。", "recordsには成功・失敗を含む出力と秒数、summary.jsonには集計と事前基準があります。", "発話なし対照はCERの分母にせず、文字が出た条件数と文字数を数えます。", "cleanとpauseはそれぞれCER悪化1ポイント以内、削除率悪化1ポイント以内、新たな全文欠落ゼロが必要です。", "clean_pause_condition_checksに各判定を残します。挿入が減ってCERが改善しても、削除率や新たな全文欠落の基準を外れた設定は採用しません。", "quietはpauseの音量だけを24dB下げ、quiet_noiseはさらに白色雑音を加えた条件です。", "低音量2条件はそれぞれCER悪化2ポイント以内、削除率悪化2ポイント以内、新たな全文欠落なしを判定します。", "baselineと対象VADの双方でmicro CER 30%以下・12文中10文以上の文別CER 30%以下・全文欠落ゼロも必要です。", "baselineがこの下限を満たさなければ、その条件の保持は判定前提不足であり合格には数えません。", "同じ系列内のpause→quietとquiet→quiet_noiseの差はwithin_arm_condition_contrastsで確認できます。", "FLEURSは朗読です。加工した音声や無音の割合から実会議全般の性能を保証できません。", "初回は別プロセスでのロード込みであり、OSキャッシュを消した冷間測定ではありません。", "RSSはmacOS time -lのbytes。MLX割当量とは合計しません。", "", "出典: Conneau et al., FLEURS (2022), https://arxiv.org/abs/2205.12446", "データ: https://huggingface.co/datasets/google/fleurs/tree/" + DATA_REVISION, "利用条件: CC BY 4.0。音声への無音追加・振幅変更・合成雑音追加を行いました。", "モデル: https://huggingface.co/mlx-community/whisper-large-v3-turbo/tree/" + MODEL_REVISION, "上流モデル: https://huggingface.co/openai/whisper-large-v3-turbo (MIT)", "Silero VAD: https://github.com/snakers4/silero-vad/tree/6478567951ae5c9979ad7b234185b5515f4be7a1 (MIT)", ""] (RESULTS / "README.md").write_text("\n".join(readme), encoding="utf-8") if not complete: raise RuntimeError("Experiment incomplete; no comparative conclusion permitted") if __name__ == "__main__": mode = sys.argv[1] try: if mode == "prepare": prepare() elif mode == "arm": arm(sys.argv[2]) elif mode == "resources": resources(sys.argv[2], int(sys.argv[3])) elif mode == "summary": summary() else: raise ValueError("Unknown entry point") except Exception as exc: write_json(f"failure-{mode}.json", {"stage": mode, "status": "failed", "error": safe_error(exc)}) print(json.dumps(safe_error(exc), ensure_ascii=False), file=sys.stderr) sys.exit(1) PY "$LAB/venv/bin/python" -m pip check > "$LAB/logs/dependency-check.txt" "$LAB/venv/bin/python" "$LAB/measure.py" prepare for arm_name in baseline vad05 vad08; do exit_code=0 /usr/bin/time -l "$LAB/venv/bin/python" "$LAB/measure.py" arm "$arm_name" \ > "$LAB/logs/$arm_name-output.txt" 2> "$LAB/logs/$arm_name-time.txt" || exit_code=$? "$LAB/venv/bin/python" "$LAB/measure.py" resources "$arm_name" "$exit_code" if [ "$exit_code" -ne 0 ]; then "$LAB/venv/bin/python" "$LAB/measure.py" summary || true exit "$exit_code" fi done "$LAB/venv/bin/python" "$LAB/measure.py" summary