metadata
license: mit
library_name: transformers.js
base_model: pyannote/segmentation-3.0
https://huggingface.co/pyannote/segmentation-3.0 with ONNX weights to be compatible with Transformers.js.
Torch → ONNX conversion code:
# pip install torch onnx https://github.com/pyannote/pyannote-audio/archive/refs/heads/develop.zip
import torch
from pyannote.audio import Model
model = Model.from_pretrained(
"pyannote/segmentation-3.0",
use_auth_token="hf_...", # <-- Set your HF token here
).eval()
dummy_input = torch.zeros(2, 1, 160000)
torch.onnx.export(
model,
dummy_input,
'model.onnx',
do_constant_folding=True,
input_names=["input_values"],
output_names=["logits"],
dynamic_axes={
"input_values": {0: "batch_size", 1: "num_channels", 2: "num_samples"},
"logits": {0: "batch_size", 1: "num_frames"},
},
)
Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using 🤗 Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx
).