Skip to content

Conversation

@antoine-tran
Copy link
Contributor

@antoine-tran antoine-tran commented Dec 8, 2025

Why ?

This big PR pushes the internal changes of AudioSeal inside Meta to the public repository. It consists of several improvements, fixes and new features:

  • Add new models with streaming support (audioseal_wm_streaming, audioseal_detector_streaming)
  • Refactor code to make the functions torchscriptable
  • Deprecate the internal resampling during watermark generation and detection
  • Fix bugs in load user-defined secret messages with mis-matching batch size
  • Update example notebooks

How ?

  • We use the new backend for SEANet encoder / decoder that relies on Moshi, which supports causal training.
  • Note that the streaming audioseal only supports python 3.10 and later, and PyTorch 2.6 due to the use of torch dynamo. If the user installed audioseal in an environment with the older libraries / python, this will be disabled automatically.

Test plan

  1. Run the new test for testing the scripting function
  2. Run notebooks to see how the streaming audioseal performs
  3. Check CI for regression

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds streaming support to AudioSeal by integrating the Moshi SEANet backend for Python 3.10+, enabling causal training and real-time watermarking. The changes also make models TorchScript-compatible, deprecate internal audio resampling (shifting responsibility to users), and fix bugs in message handling.

Key changes:

  • Add streaming-capable models (audioseal_wm_streaming, audioseal_detector_streaming) with context manager API
  • Refactor for TorchScript compatibility by removing weight normalization hooks before scripting
  • Deprecate internal 16kHz resampling - users must now provide correctly sampled audio

Reviewed changes

Copilot reviewed 27 out of 31 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
tests/test_models.py Adds JIT scripting test for generator and detector models
src/audioseal/models.py Adds NormalizationProcessor, streaming context manager, TorchScript exports, deprecation warnings
src/audioseal/loader.py Implements state dict conversion for Moshi models, improved weight norm handling
src/audioseal/builder.py Adds version-conditional imports for SEANet (Moshi vs Audiocraft)
src/scripts/checkpoints.py Improves checkpoint conversion with prefix support and safer torch.load
src/audioseal/libs/moshi/* Integrates Moshi library modules (SEANet, streaming, transformer, etc.)
src/audioseal/cards/*.yaml Adds configuration cards for streaming models
README.md Documents streaming API usage and requirement changes
CHANGELOG.md Documents version 0.2.0 changes
requirements.txt, pyproject.toml Removes julius, adds einops for Python 3.10+
.github/workflows/lint_and_test.yaml Updates CI to Python 3.10 and removes julius dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@antoine-tran antoine-tran mentioned this pull request Dec 9, 2025
Copy link
Contributor

@hadyelsahar hadyelsahar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@antoine-tran antoine-tran merged commit a0ce256 into main Dec 19, 2025
7 checks passed
@antoine-tran antoine-tran deleted the sync_08_12_2025_094405UTC branch December 19, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants