half-duplex / README.md
Nampfiev1995's picture
Upload Half Duplex Space app
4e0bdbb verified
|
Raw
History Blame Contribute Delete
2.08 kB
---
title: Inference Half Duplex
emoji: ๐Ÿš€
colorFrom: gray
colorTo: purple
sdk: gradio
python_version: '3.11'
app_file: app.py
license: apache-2.0
---
# Inference Half Duplex
This folder is for the minimized ONNX inference demo.
## Hugging Face Spaces
This repo can run as a Gradio Space. Create a new Space with the Gradio SDK,
then push this repository, including `app.py`, `requirements.txt`,
`packages.txt`, `runtime.txt`, and the `models/` directory.
The app downloads `anyreach-ai/dualturn-qwen2.5-mimi-0.5B` on first use, so the
first run can take a while. If you use a CPU Space, leave the device set to
`cpu`; on GPU Spaces the UI defaults to `cuda`.
## Models
- `models/pvad_core.onnx`: exported Personal VAD core from
`vad_lstm_personal_light_lstm_fixed.safetensors`.
- `models/silero_vad.jit`: Silero VAD frontend used to compute `vad_score`
for `pvad_core.onnx`.
`pvad_core.onnx` expects the Silero VAD score to be computed outside the graph.
`check_pipeline.py` does this with `models/silero_vad.jit`.
Inputs:
- `frame_pcm`: float32 `[batch, 512]`
- `target_vector`: float32 `[batch, 16]`
- `vad_score`: float32 `[batch, 1]`
- `h0`: float32 `[1, batch, 64]`
- `c0`: float32 `[1, batch, 64]`
Outputs:
- `final_prob`: target probability after multiplying by `vad_score`
- `raw_prob`: raw target/non-target probability
- `frame_embed`: 16-dim frame embedding
- `hn`, `cn`: next LSTM state
Re-export from the source repo:
```bash
cd /Utilisateurs/tnguye28/vad-lstm
UV_CACHE_DIR=/tmp/uv-cache NUMBA_CACHE_DIR=/tmp/numba-cache uv run python scripts/export_pvad_core_onnx.py --output /Utilisateurs/tnguye28/inference-half-duplex/models/pvad_core.onnx
```
Run the pipeline smoke test:
```bash
cd /Utilisateurs/tnguye28/inference-half-duplex
UV_CACHE_DIR=/tmp/uv-cache NUMBA_CACHE_DIR=/tmp/numba-cache uv run python check_pipeline.py
```
Run the Gradio demo:
```bash
cd /Utilisateurs/tnguye28/vad-lstm
GRADIO_SERVER_PORT=8787 UV_CACHE_DIR=/tmp/uv-cache NUMBA_CACHE_DIR=/tmp/numba-cache uv run python /Utilisateurs/tnguye28/inference-half-duplex/app.py
```