Arc B580 lost the kill test: batch-14 mask p50 103 ms vs Torch CPU 70 ms enhance / OpenVINO CPU 5 ms. Production stays on known-good CPU workers (tag known-good-cpu-2026-08-28). Hop stays 200 ms.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Dump MetricGAN enhance_model I/O so the OpenVINO spike can convert it."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
|
|
import torch
|
|
from speechbrain.inference.enhancement import SpectralMaskEnhancement
|
|
|
|
SAVEDIR = "/root/.cache/speechbrain-enhancement"
|
|
|
|
|
|
def main() -> None:
|
|
m = SpectralMaskEnhancement.from_hparams(
|
|
source="speechbrain/metricgan-plus-voicebank",
|
|
savedir=SAVEDIR,
|
|
run_opts={"device": "cpu"},
|
|
)
|
|
net = m.mods.enhance_model
|
|
print("enhance_model", type(net).__name__)
|
|
print("device", m.device)
|
|
wav = torch.randn(1, 16000)
|
|
feats = m.compute_features(wav)
|
|
print("wav", tuple(wav.shape), "feats", tuple(feats.shape), feats.dtype)
|
|
lengths = torch.tensor([1.0])
|
|
with torch.no_grad():
|
|
mask = net(feats, lengths=lengths)
|
|
print("mask", tuple(mask.shape), mask.dtype)
|
|
print("modules:")
|
|
for name, mod in net.named_children():
|
|
print(f" {name}: {type(mod).__name__}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|