Make repo self-contained: inference wrapper code and arena_entry.yaml
Browse files- arena_entry.yaml +7 -0
- trt_pellav2.py +14 -1
arena_entry.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# How Arena drivers load this model (discovered from the repo; no central registry needed)
|
| 2 |
+
module: pellav2
|
| 3 |
+
class: Pellav2
|
| 4 |
+
trt_module: trt_pellav2
|
| 5 |
+
trt_class: Pellav2TRT
|
| 6 |
+
sample_rate: 16000
|
| 7 |
+
devices: 1
|
trt_pellav2.py
CHANGED
|
@@ -69,11 +69,24 @@ def load_model():
|
|
| 69 |
return m
|
| 70 |
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
def real_audio(n=64):
|
| 73 |
import pyarrow.parquet as pq
|
| 74 |
import soundfile as sf
|
| 75 |
import torchaudio.functional as AF
|
| 76 |
-
files = sorted((
|
| 77 |
out = []
|
| 78 |
for f in files:
|
| 79 |
t = pq.read_table(f, columns=["audio"])
|
|
|
|
| 69 |
return m
|
| 70 |
|
| 71 |
|
| 72 |
+
def _parity_data_dir() -> Path:
|
| 73 |
+
"""Dir with the parity clips (<PARITY_DATASET> data/*.parquet; the clips used are unchanged).
|
| 74 |
+
|
| 75 |
+
$ARENA_PARITY_DIR if set, else $ARENA_DATASETS/arena/<PARITY_DATASET>/data if ARENA_DATASETS is set,
|
| 76 |
+
else the legacy sibling layout <repo>/../<PARITY_DATASET>/data.
|
| 77 |
+
"""
|
| 78 |
+
if os.environ.get("ARENA_PARITY_DIR"):
|
| 79 |
+
return Path(os.environ["ARENA_PARITY_DIR"])
|
| 80 |
+
if os.environ.get("ARENA_DATASETS"):
|
| 81 |
+
return Path(os.environ["ARENA_DATASETS"]) / "arena" / PARITY_DATASET / "data"
|
| 82 |
+
return HERE.parent / PARITY_DATASET / "data"
|
| 83 |
+
|
| 84 |
+
|
| 85 |
def real_audio(n=64):
|
| 86 |
import pyarrow.parquet as pq
|
| 87 |
import soundfile as sf
|
| 88 |
import torchaudio.functional as AF
|
| 89 |
+
files = sorted(_parity_data_dir().glob("test-*.parquet"))
|
| 90 |
out = []
|
| 91 |
for f in files:
|
| 92 |
t = pq.read_table(f, columns=["audio"])
|