Implementation:Facebookresearch Audiocraft AudioSeal WMModel
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Audio_Watermarking, Model_Architecture |
| Last Updated | 2026-02-14 01:00 GMT |
Overview
Concrete tool for audio watermark embedding and detection using the AudioSeal architecture.
Description
This module defines the abstract WMModel interface for audio watermarking and provides the AudioSeal implementation. WMModel defines the API with get_watermark, detect_watermark, and nbits property. AudioSeal wraps the audioseal library's generator and detector models, handling message encoding and detection output parsing.
Usage
Import this class when you need to embed or detect audio watermarks using a trained AudioSeal model.
Code Reference
Source Location
- Repository: Facebookresearch_Audiocraft
- File: audiocraft/models/watermark.py
- Lines: 1-111
Signature
class WMModel(ABC):
@abstractmethod
def get_watermark(self, x: torch.Tensor, message: tp.Optional[torch.Tensor] = None) -> torch.Tensor: ...
@abstractmethod
def detect_watermark(self, x: torch.Tensor) -> torch.Tensor: ...
@property
@abstractmethod
def nbits(self) -> int: ...
class AudioSeal(WMModel):
def __init__(self, generator, detector, nbits: int = 0): ...
Import
from audiocraft.models.watermark import AudioSeal, WMModel
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| x | torch.Tensor | Yes | Audio signal [B, C, T] |
| message | torch.Tensor | No | Message bits to embed [B, nbits] |
Outputs
| Name | Type | Description |
|---|---|---|
| watermark | torch.Tensor | Additive watermark signal [B, C, T] (from get_watermark) |
| detection | torch.Tensor | Detector output [B, 2+nbits, T] (from detect_watermark) |
Usage Examples
from audiocraft.solvers.watermark import WatermarkSolver
# Load from checkpoint
model = WatermarkSolver.model_from_checkpoint('path/to/checkpoint', device='cuda')
watermark = model.get_watermark(audio, message=message)
watermarked = audio + watermark
detection = model.detect_watermark(watermarked)
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment