How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-to-speech", model="RetentionLabs/EmoTra-TTS", trust_remote_code=True)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("RetentionLabs/EmoTra-TTS", trust_remote_code=True, device_map="auto")
Quick Links

EmoTra-TTS

This is a research reproduction of EmoTra-TTS, trained by us for research comparison. It is not an official checkpoint of the EmoTra-TTS authors.

EmoTra-TTS (Liu et al., EMNLP 2026) fine tunes CosyVoice2 so that the emotion inside one utterance moves from a start VAD (arousal, valence, dominance) to an end VAD. This repository holds our reproduction on FunAudioLLM/CosyVoice2-0.5B, trained with the upstream recipe on one English speaker (ash of EmoVoice-DB), in the transformers format with self-contained remote code.

Model summary

Input English text, a start VAD and an end VAD, each [arousal, valence, dominance] in $[0, 1]$
Output 24 kHz waveform
Speaker One fixed speaker (ash of EmoVoice-DB); the model is not zero shot
Networks Qwen2 speech token language model (0.5B), chunk aware flow matching model, HiFT vocoder
Precision BF16 parameters, see Precision
Training data RetentionLabs/emotra-ash-transition-50k

Architecture

EmoTra-TTS changes two of the three CosyVoice2 networks and keeps the vocoder.

  • Language model (Stage I). The start and end VAD are interpolated into 5 points, token $k$ carrying $(1-\alpha_k)\mathbf v_{start}+\alpha_k\mathbf v_{end}$ with $\alpha_k=k/4$. Each point is projected to one input embedding (llm.vad_projection), and the 5 VAD tokens sit between the start of sequence embedding and the text: [sos, VAD_0 ... VAD_4, text, task_id, speech]. An auxiliary perceptron (llm.hidden_reconstructor) maps the first and the last VAD token to the pooled hidden states of the audEERING w2v2 VAD regressor on the two reference utterances. The loss is $\mathcal L_{CE}+0.1,\mathcal L_{hidden}$.
  • Flow matching model (Stage II). A per frame emotion embedding is added to the speaker input of the estimator: $\hat e(t)=e+\epsilon,\mathrm{LN}(\psi_{down}(\phi_{recon}(\phi_{proj}(\mathbf v(t)))))$ with $\epsilon=0.07$. $\phi_{proj}$ and $\phi_{recon}$ are copies of the two Stage I modules, $\psi_{down}$ is flow.vad_downsample and LN is flow.emo_layer_norm. $\mathbf v(t)$ holds the start VAD for the first 40 % of the mel frames, moves linearly to the end VAD until 70 %, and holds the end VAD after it. Generation runs without a prompt and with zero mel conditioning.

Usage

import soundfile as sf
import torch
from transformers import AutoModel, AutoProcessor

model = AutoModel.from_pretrained("RetentionLabs/EmoTra-TTS", trust_remote_code=True).to("cuda").eval()
processor = AutoProcessor.from_pretrained("RetentionLabs/EmoTra-TTS", trust_remote_code=True)

inputs = processor(text="The weather was so bad that day, and then I suddenly saw something that made me angry.")
# [arousal, valence, dominance] in [0, 1], the order of the training data
vad_start = torch.tensor([[0.27, 0.25, 0.31]], dtype=torch.bfloat16, device="cuda")
vad_end = torch.tensor([[0.85, 0.20, 0.86]], dtype=torch.bfloat16, device="cuda")

torch.manual_seed(0)
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
    waveform = model.generate(
        input_ids=inputs["input_ids"].to("cuda"),
        speaker_embedding=inputs["speaker_embedding"].to("cuda", torch.bfloat16),
        vad_start=vad_start,
        vad_end=vad_end,
    )
sf.write("output.wav", waveform[0].float().cpu().numpy(), model.config.sample_rate)

The remote code needs transformers (tested with 5.19.0), torch, torchaudio, numpy and safetensors. Loading downloads nothing besides this repository. generate samples speech tokens with repetition aware sampling (top p 0.8, top k 25), so the output depends on the seed. Run it under BF16 autocast as above: the flow matching model returns an FP32 mel spectrogram and the BF16 vocoder takes it through autocast, which is how our evaluation generated audio.

The processor tokenizes the text as it is (no text normalization; write numbers as words) and returns speaker_embedding, the fixed CAM++ embedding of one neutral recording of the speaker (gpt4o_6212_neutral_ash.wav of EmoVoice-DB) that the flow matching model was trained with. The VAD order is the training data's [arousal, valence, dominance], not the $(V, A, D)$ of the paper's notation.

Files

File Content
model.safetensors Merged weights: CosyVoice2-0.5B, the Stage I language model, the flow VAD modules copied from it, and the Stage II flow emotion modules, as the training code assembles them for generation
config.json EmoTraTTSConfig
configuration_emotra_tts.py, modeling_emotra_tts.py, generation_emotra_tts.py Model code. The CosyVoice2 classes are copied in; only transformers and torch are imported
processing_emotra_tts.py, feature_extraction_emotra_tts.py Processor: text tokenizer, fixed speaker embedding, and for training inputs the CosyVoice2 speech tokenizer and the 24 kHz mel extractor
tokenizer.json, tokenizer_config.json, chat_template.jinja The CosyVoice2 text tokenizer (Qwen2 of CosyVoice-BlankEN with the CosyVoice2 special tokens)
speaker_embedding.safetensors The fixed speaker embedding (192)
speech_tokenizer.safetensors The CosyVoice2 speech tokenizer, read out of speech_tokenizer_v2.onnx of CosyVoice2-0.5B
processor_config.json Processor and mel extractor settings
train.py Training code of both stages (see Training)
stage1/ Stage I checkpoint at step 2,048: trainable.safetensors (every llm.* parameter, BF16), config.json, trainer_state.json
stage2/ Stage II checkpoint at step 1,316: trainable.safetensors (flow.vad_downsample and flow.emo_layer_norm, BF16), config.json, trainer_state.json

stage1/ and stage2/ are the raw training checkpoints. train.load_for_generation rebuilds the merged weights from them and the CosyVoice2-0.5B backbone.

Training

Both stages follow the upstream recipes (conf/cosyvoice2_EmoTra_sft_LLM.yaml, conf/cosyvoice2_EmoTra_sft_Flow_Lynorm_fixs.yaml). Stage I trains the whole language model, as the upstream code does; the paper text says only the VAD modules, the code trains all of llm. Both stages keep the model in BF16 with BF16 autocast and step FP32 master copies of the trainable parameters with Adam. Hardware: 2 NVIDIA RTX PRO 6000 Blackwell GPUs, data parallel.

Stage I Stage II
Trainable Whole language model (llm.*) flow.vad_downsample, flow.emo_layer_norm (283,120 parameters)
Starting point CosyVoice2-0.5B, EmoTra-TTS modules newly initialized Frozen CosyVoice2-0.5B flow model, VAD modules copied from Stage I step 2,048
Training records 45,000 39,451 (records whose Stage I decode kept at least 100 tokens)
Held-out records 5,000 4,411
Optimizer Adam, lr $10^{-5}$, constant, no weight decay Adam, lr $5\times10^{-5}$, constant, eps $10^{-8}$, L2 weight decay $10^{-6}$
Gradient clipping 5 1
Batch per update 176 (44 per GPU, 2 GPUs, accumulation 2) 120 (30 per GPU, 2 GPUs, accumulation 2)
Steps 2,048 (8 epochs) 1,316 (4 epochs)
Held-out loss at the last step 2.7353 ($\mathcal L_{CE}+0.1,\mathcal L_{hidden}$) 0.8509 (conditional flow matching loss)

Stage II inputs are the speech tokens the Stage I model decodes for each record (0.5 to 1.5 times the ground truth length, cut or padded to it, records under 100 tokens dropped), as upstream's precompute_llm_tokens_sft_LLM.py does. Half of the Stage II batches run in streaming mode. The held-out losses are on the held-out split of the transition data, which the runs did not train on.

train.py holds this training code without the data preparation. Its docstring gives the record format it reads. It loads the CosyVoice2-0.5B backbone from the upstream files and imports the model files of this repository.

Training data

The training data is RetentionLabs/emotra-ash-transition-50k: 50,000 synthetic intra-utterance emotion transitions of the speaker ash, split into 45,000 training and 5,000 held-out records, built with the upstream data scripts (step0 to step2). Its source recordings are from yhaha/EmoVoice-DB, an emotional speech corpus generated with GPT-4o. Each transition record pairs two EmoVoice-DB recordings of the speaker (A and B) and holds CosyVoice2 speech of the text of A whose emotion moves from that of A to that of B. The license status of model weights trained on GPT-4o generated speech may be ambiguous.

Precision

All model parameters and floating point buffers are BF16 (config.dtype). A BF16 load also casts the non-persistent rotary inv_freq buffers of the Qwen2 decoder to BF16, as the training and evaluation code did with model.to(torch.bfloat16). The exceptions are operations BF16 cannot compute or represent:

Part dtype Reason
HiFT STFT and ISTFT FP32 The vocoder's spectral transforms run on FP32 inputs and return the input dtype
Speech tokenizer finite scalar quantizer (quantizer.project_in) FP32 Token ids reach $3^8-1=6560$; BF16 represents integers exactly only up to 256
Vocoder input BF16 autocast The flow matching model returns an FP32 mel spectrogram

The processor's speech tokenizer is BF16 except the quantizer. The speech tokens of the training data were extracted with the speech tokenizer in FP32; on one held-out recording the BF16 tokenizer reproduces 114 of 116 of those tokens and the FP32 tokenizer all 116.

Verification

The released folder, loaded in a fresh process with trust_remote_code=True and without the training code installed, was compared with the model the training code assembles from stage1/, stage2/ and CosyVoice2-0.5B (BF16, one NVIDIA B300, one held-out record of the transition data):

Check Result
State dict 1,773 tensors, bitwise equal
Stage I teacher forced logits (139 positions, 6,564 classes) max abs diff 0
Flow matching mel spectrogram (fixed noise, 232 frames) max abs diff 0
generate with seed 0, waveform (120,960 samples) max abs diff 0
Processor text ids and speaker embedding equal

Checkpoints of the authors

No official EmoTra-TTS checkpoint is public. Searched on 2026-10-12: the Hugging Face Hub (models, datasets, Spaces for emotra, emotra-tts and the author), the upstream repository (no releases, tags or download links), Zenodo and the demo page. In upstream issue #1 the first author wrote on 2026-09-08 that the checkpoints of the paper and demo cannot be released.

Patent notice

The upstream README states:

Patent Notice. The core method of EmoTra-TTS has been submitted for patent protection. Please see the License section for details.

License

The model weights are released under CC BY-NC 4.0 (LICENSE), for non-commercial academic research, following the authors' stated intent in the paper's Ethical Statement. The code files are Apache-2.0, as derived from EmoTra-TTS and CosyVoice; dynamic_range_compression and mel_spectrogram in modeling_emotra_tts.py are from BigVGAN (MIT). See NOTICE.

Citation

@inproceedings{liu2026emotra,
  title={EmoTra-TTS: Smooth Intra-Utterance Emotion Transitions for Speech Synthesis},
  author={Liu, Tianchi and Song, Zeyang and Wang, Tianrui and Li, Zhipeng and Xu, Chenglin and Guo, Yiwen},
  booktitle={Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing},
  year={2026}
}

Reproduction by TICTAP-11 and b-re-w (Retention Labs).

Downloads last month
-
Safetensors
Model size
0.6B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for RetentionLabs/EmoTra-TTS

Finetuned
(15)
this model

Datasets used to train RetentionLabs/EmoTra-TTS

Collection including RetentionLabs/EmoTra-TTS

Paper for RetentionLabs/EmoTra-TTS