-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Add MOSS-TTS-v1.5 (delay) and MOSS-Audio-Tokenizer #46447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ted-mosi
wants to merge
42
commits into
huggingface:main
Choose a base branch
from
ted-mosi:add-mosstts-v1-5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 24 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
316b1d4
WIP.
ted-mosi d7b14b0
Style fix.
ted-mosi 9abb0d3
Fix.
ted-mosi 1a3374d
Style fix.
ted-mosi 877d4c0
Fix.
ted-mosi 8fbf108
Fix.
ted-mosi 1db616b
Fix.
ted-mosi 8ab4caa
Fix.
ted-mosi 01ffaa0
Added first integration test.
ted-mosi add3628
Added more integration test.
ted-mosi 1a0c7c3
Added MOSS-Audio-Tokenizer.
ted-mosi f492dc2
Fix.
ted-mosi cc1f177
Refactored the test for tts_robust_normalizer.
ted-mosi ccbd777
Updated the doc for MOSS-TTS-V1.5 (delay).
ted-mosi 1ffb5fd
Address code review.
ted-mosi c1aa792
Merge branch 'main' into add-mosstts-v1-5
ted-mosi c64d5cc
Fix.
ted-mosi 5d55d4e
Fix pipeline.
ted-mosi bb811e6
Addressed the comment about using explicit config attributes. Keeping…
ted-mosi 5ccd906
Addressed the comment about redundant output_attentions and instead r…
ted-mosi 60300e9
Addressed the comments about config fields.
ted-mosi ccd55a9
Addressed the comments about RoPE & RMS norm & Attention.
ted-mosi 3fdca8e
Fix.
ted-mosi 36a2ab2
Fix.
ted-mosi cd24776
Addressed second round of code review.
ted-mosi e36bd02
Removed file.
ted-mosi aac1268
Attempt to pass pipeline.
ted-mosi dc27661
Removed a unused block of code.
ted-mosi 5e88f5e
Attempt to pass pipeline.
ted-mosi c097e65
Attempt to pass pipeline.
ted-mosi 18e4643
Attempt to pass pipeline.
ted-mosi 5dea024
WIP.
ted-mosi 7989050
WIP.
ted-mosi 8079202
WIP.
ted-mosi 74b84d5
WIP.
ted-mosi b55f042
WIP.
ted-mosi 7f2d7d2
Addressed all review comments.
ted-mosi d8920b0
Fix.
ted-mosi 1fbd5c2
Rename.
ted-mosi c609daf
Updated docs.
ted-mosi 87c2e8a
Fix style.
ted-mosi 9479039
Fix date.
ted-mosi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <!--Copyright 2026 OpenMOSS and The HuggingFace Team. All rights reserved. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations under the License. | ||
|
|
||
| ⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be | ||
| rendered properly in your Markdown viewer. | ||
|
|
||
| --> | ||
| *This model was contributed to Hugging Face Transformers on 2026-06-14.* | ||
|
|
||
| # MOSS Audio Tokenizer | ||
|
|
||
| [MOSS-Audio-Tokenizer](https://huggingface.co/OpenMOSS-Team/MOSS-Audio-Tokenizer) is the neural audio codec used by | ||
| MOSS-TTS. It encodes waveforms into discrete audio codebook tokens and decodes those tokens back into waveform audio. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```python | ||
| import torch | ||
|
|
||
| from transformers import MossAudioTokenizerModel | ||
|
ted-mosi marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| model_id = "OpenMOSS-Team/MOSS-Audio-Tokenizer" | ||
| model = MossAudioTokenizerModel.from_pretrained(model_id, device_map="auto") | ||
|
|
||
| audio = torch.randn(1, 1, 24000, device=model.device) | ||
|
|
||
| encoded = model.encode(audio, return_dict=True) | ||
|
ted-mosi marked this conversation as resolved.
Outdated
|
||
| audio_codes = encoded.audio_codes | ||
|
|
||
| decoded = model.decode(audio_codes, return_dict=True) | ||
| audio_values = decoded.audio | ||
| ``` | ||
|
|
||
| ## MossAudioTokenizerConfig | ||
|
|
||
| [[autodoc]] MossAudioTokenizerConfig | ||
|
|
||
| ## MossAudioTokenizerEncoderConfig | ||
|
|
||
| [[autodoc]] MossAudioTokenizerEncoderConfig | ||
|
|
||
| ## MossAudioTokenizerDecoderConfig | ||
|
|
||
| [[autodoc]] MossAudioTokenizerDecoderConfig | ||
|
|
||
| ## MossAudioTokenizerQuantizerConfig | ||
|
|
||
| [[autodoc]] MossAudioTokenizerQuantizerConfig | ||
|
|
||
| ## MossAudioTokenizerModel | ||
|
|
||
| [[autodoc]] MossAudioTokenizerModel | ||
| - encode | ||
| - decode | ||
| - batch_encode | ||
| - batch_decode | ||
| - forward | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <!--Copyright 2026 OpenMOSS and The HuggingFace Team. All rights reserved. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations under the License. | ||
|
|
||
| ⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be | ||
| rendered properly in your Markdown viewer. | ||
|
|
||
| --> | ||
| *This model was contributed to Hugging Face Transformers on 2026-06-14.* | ||
|
|
||
| # MOSS-TTS Delay | ||
|
|
||
| [MOSS-TTS-v1.5](https://huggingface.co/OpenMOSS-Team/MOSS-TTS-v1.5) is a multilingual text-to-speech model from | ||
| OpenMOSS. The model uses a Qwen3 language backbone and predicts delayed audio codebook tokens for speech generation. | ||
|
|
||
| ## Usage | ||
|
ted-mosi marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| from scipy.io.wavfile import write | ||
|
|
||
| from transformers import AutoProcessor, AutoModelForTextToWaveform | ||
|
|
||
|
|
||
| model_id = "OpenMOSS-Team/MOSS-TTS-v1.5" | ||
|
|
||
| processor = AutoProcessor.from_pretrained(model_id) | ||
| model = AutoModelForTextToWaveform.from_pretrained(model_id, dtype="auto", device_map="auto") | ||
|
|
||
| message = processor.build_user_message(text="Hello from MOSS-TTS.", language="English") | ||
| inputs = processor([message]).to(model.device) | ||
| outputs = model.generate(**inputs, max_new_tokens=1024) | ||
|
|
||
| messages = processor.decode(outputs) | ||
| audio_values = messages[0].audio_codes_list[0] | ||
| write("moss_tts.wav", processor.model_config.sampling_rate, audio_values.cpu().numpy()) | ||
| ``` | ||
|
|
||
| ## MossTTSDelayConfig | ||
|
|
||
| [[autodoc]] MossTTSDelayConfig | ||
|
|
||
| ## MossTTSDelayProcessor | ||
|
|
||
| [[autodoc]] MossTTSDelayProcessor | ||
|
|
||
| ## Message | ||
|
|
||
| [[autodoc]] Message | ||
|
|
||
| ## UserMessage | ||
|
|
||
| [[autodoc]] UserMessage | ||
|
|
||
| ## AssistantMessage | ||
|
|
||
| [[autodoc]] AssistantMessage | ||
|
|
||
| ## MossTTSDelayModel | ||
|
|
||
| [[autodoc]] MossTTSDelayModel | ||
| - forward | ||
|
|
||
| ## MossTTSDelayOutputWithPast | ||
|
|
||
| [[autodoc]] MossTTSDelayOutputWithPast | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright 2026 OpenMOSS and the HuggingFace Inc. team. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from ...utils import _LazyModule | ||
| from ...utils.import_utils import define_import_structure | ||
|
|
||
|
|
||
| if TYPE_CHECKING: | ||
| from .configuration_moss_audio_tokenizer import * | ||
| from .modeling_moss_audio_tokenizer import * | ||
| else: | ||
| import sys | ||
|
|
||
| _file = globals()["__file__"] | ||
| sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.