Instructions to use thapaee/audioseal-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- AudioSeal
How to use thapaee/audioseal-onnx with AudioSeal:
# Watermark Generator from audioseal import AudioSeal model = AudioSeal.load_generator("thapaee/audioseal-onnx") # pass a tensor (tensor_wav) of shape (batch, channels, samples) and a sample rate wav, sr = tensor_wav, 16000 watermark = model.get_watermark(wav, sr) watermarked_audio = wav + watermark# Watermark Detector from audioseal import AudioSeal detector = AudioSeal.load_detector("thapaee/audioseal-onnx") result, message = detector.detect_watermark(watermarked_audio, sr) - Notebooks
- Google Colab
- Kaggle
AudioSeal (16-bit) in ONNX
Meta's AudioSeal audio watermark, the 16-bit generator and detector, converted to ONNX. VoicedByMe uses it to mark the speech it generates as AI-made. The weights are Meta's, unchanged: only the file format is different. Code and weights are under the MIT license (see LICENSE).
| File | What it does | SHA-256 |
|---|---|---|
audioseal-16bit-generator.onnx |
Makes the watermark for a clip | c7954ebc5a097c41c10b099d80e1cb218168d79ed56f19138b1f43d705a1524b |
audioseal-16bit-detector.onnx |
Finds the watermark and reads its message | 02856c2d372472314c674fb000a1844c6c38b0a75703371dd9255f83e2a841c1 |
How it was made
From the audioseal 0.2.0 package's checkpoints (audioseal_wm_16bits,
audioseal_detector_16bits, from facebook/audioseal),
exported with PyTorch's ONNX exporter (opset 17). The model's padding is worked out for
lengths that are a multiple of 320 samples, so the graph works for any such length. On
those lengths the results match PyTorch's to within about 1e-7.
Using it
Both models take 16 kHz mono audio, (1, 1, T) float32, where T is a multiple of 320
(pad with zeros and cut back afterwards).
- Generator: inputs
audioandmessage(1, 16)int64 (the bits). Outputwatermark(1, 1, T); the marked audio isaudio + watermark. - Detector: input
audio. Outputsprob(1, T)(how likely each sample is marked) andbits(1, 16, T)(bit logits; average over time, then > 0 means 1). The message reads back only when the audio is on the same 20 ms grid as when it was marked, so for audio that may have been shifted (some encoders add a delay), try offsets of 0 to 319 samples.