63 Commits

Author SHA1 Message Date
Arcitec
dfe1bd41d8 refactor: Remove code duplication in DeepSpeed dependency check 2025-09-08 16:17:17 +02:00
Arcitec
a6a955d2aa fix: Add support for melancholic emotion in text-to-emotion vectors
- The "低落" (melancholic) emotion will always be mapped to "悲伤" (sad) by QwenEmotion's text analysis. It doesn't know the difference between those emotions even if the user writes the exact words.

- Since the words and their meanings are so similar, it might not be possible to train QwenEmotion to learn the difference.

- As a workaround, we perform input text analysis and look for words that mean "melancholic", and swap the "sad" detection result, to make the melancholic/low-energy speech emotion work correctly for users via text-to-emotion.
2025-09-08 16:14:38 +02:00
Arcitec
58ad225fb4 fix: Fast and robust text-to-emotion algorithm
- The new algorithm is now very fast and uses less memory, since it doesn't chain multiple `.replace()` calls or create a bunch of temporary strings and temporary dictionaries and lists anymore.

- Parses the JSON output from the QwenEmotion model directly instead of trying to manually parse it. If JSON parsing fails, it falls back to a fast and highly-accurate RegEx search which finds all key-value pairs.

- The desired emotion vector order is now stored as a static class attribute instead of being created from scratch on every call.

- The emotion dictionary creation has been completely rewritten to use a clear algorithm which takes the QwenEmotion answers, builds a new dictionary using `self.desired_vector_order`, maps each key's name to their English translations, fetches the values from QwenEmotion's answers or 0.0 if no value was given by QE, and clamps the values to the min/max ranges.

- The `backup_dict` is now removed, since it was error-prone and fragile. It could grow out of sync with the code if not carefully maintained to keep the correct order and labels.

- To handle the "fallback" dictionary creation, we now automatically scan the final emotion vectors, and if none of them are above 0.0 (meaning we didn't detect any emotions in the input text), we give the final vectors a "calm: 1.0" value. This means that we never have to worry about the fallback dictionary's correctness.

- The previous algorithm had multiple bugs. This rewrite fixes a serious vector order bug: The old algorithm built the dictionary via the found keys, and only checked if there's 8 keys in QwenEmotion's response, but it didn't check that the keys were valid. When building the final emotion dict, it skipped any values if they were not found in QE's response. Meaning that if the QE response only contained 4 of the 8 expected emotion vector labels, those would all be added at the start of the new dictionary as the "first 4 dict slots". After that, it looped through the "backup_dict" and appended any missing values at the end. This resulted in a final emotion dictionary with the wrong order for the emotion vectors. The new code always produces the correct emotion vector order.

- Discovered another bug in the text-to-emotion handling for the "melancholic" emotion, which has never worked for Chinese or English at all. It will be fixed in an upcoming patch.
2025-09-08 16:14:38 +02:00
Arcitec
feba501013 fix: Fix internal text-to-emotion vector labels
- The order of the `convert_dict` now matches the desired order of the emotion vectors, for clarity.

- Internal text labels now match the updated English translations.

- This (and the previous commit) also fixes a bug: The previous, inaccurate Emotion translations meant that QwenEmotion could not understand words such as "low" at all (no emotion mapping), and it always mapped "hate" to "angry". With the fixed translations, QwenEmotion now correctly maps text-to-emotions from English inputs when users input the words that they've been taught by the user interface.
2025-09-08 16:14:38 +02:00
十字鱼
9d4776b082
Use without deepspeed (#280)
Use without deepspeed
2025-09-08 22:09:26 +08:00
kemuriririn
72c09ec0b7
Indextts2 (#276)
* indextts2

* update lfs for audio files

---------

Co-authored-by: wangyining02 <wangyining02@bilibili.com>
2025-09-08 17:36:39 +08:00
root
9098497272 Fix the bug that 嗯 cannot be synthesized. 2025-06-17 17:48:04 +08:00
yrom
92bb2eb0c0 fix: 避免在 MinGW-w64 环境 jit compile cuda ext 2025-05-29 09:01:56 +08:00
yrom
59c05c0765
fix: add force_rebuild flag for fused alias_free_activation and update installation instructions 2025-05-23 15:07:39 +08:00
yrom
bb4d76aa2a fix: 添加英语缩写处理
临时解决WeTextProcessing 的部分badcase
2025-05-23 10:07:48 +08:00
Yrom
7d943b362d
fix: update PINYIN_TONE_PATTERN and NormalizerZh 2025-05-21 13:01:25 +08:00
yrom
3553a3755d fix 分句逻辑,增加测试用例
不包含。!?的句子没有被正确分句
2025-05-18 22:53:51 +08:00
yrom
60a2238eac sample_kwargs 替换为 generation_kwargs 2025-05-18 19:34:41 +08:00
yrom
96d3b75708 添加警告提示:生成停止因超出 max_mel_tokens 限制 2025-05-18 19:34:41 +08:00
yrom
7e52976bd1 删除测试代码 2025-05-18 19:34:41 +08:00
yrom
1b7529cacd 适配新版本transformers 2025-05-18 19:34:41 +08:00
yrom
22eeb7625f 修正attention mask和positional embeddings
- 将之前只有text右侧填充改为cond+text 整体左侧填充
- 添加填充测试用例
2025-05-18 19:34:32 +08:00
yrom
a50cb8c287 优化文本掩码填充逻辑,改进句子桶化处理 2025-05-17 20:59:07 +08:00
yrom
4de7611bda fix 批量推理1.5版本模型问题,调整分句逻辑和参数设置
- 将pad 改为全 eos token
- 优化bucket_sentences 算法
2025-05-17 14:40:01 +08:00
yrom
8f7c1f3e93 优化inference attention mask 2025-05-17 14:38:01 +08:00
yrom
cb6c73d391 优化文本归一化和分句逻辑
修复可能的递归问题 (Fixes #124)
2025-05-17 11:16:54 +08:00
yrom
d3bd7eb8b2 Fix split_sentences_by_token 2025-04-24 23:58:16 +08:00
Yrom
475fb12574
Fix pinyin correction 2025-04-24 20:38:52 +08:00
Yrom
35b6514ee5
Enhance text normalization and tokenization
- Introduced `de_tokenized_by_CJK_char` for restoring original text from tokenized format.
- Added `TextTokenizer` class for improved tokenization, including sentence splitting and handling of special tokens.
- Enhanced `TextNormalizer` to handle names and pinyin tones with placeholder mechanisms.
- Added regression tests for new features in `regression_test.py`.
2025-04-24 20:28:44 +08:00
Yrom
dd2b7dd820
Fix autocast device type for compatibility 2025-04-24 11:00:49 +08:00
sunnyboxs
3fc7b31e10 单句推理:RTF性能至少提升 10% 2025-04-20 14:12:38 +08:00
kemuriririn
a26894de71
+回归测试脚本 (#103)
* deepspeed无法使用时回退到通常路径

* ninja支持中文路径编译补丁:BigVGAN fused cuda kernel

* 缓存参考音频的Mel

* ninja支持中文路径编译方案2:BigVGAN fused cuda kernel

* 增加批次推理:长句实现至少 2~10 倍以上的速度提升~

* fix上层目录为空时报错

* 批次推理:重要修复(漏句/丢句/音频空白)

* 批次推理:新增数据分桶机制,增强稳定性~

* +回归测试脚本

* update 回归测试脚本

* fix merge出错

---------

Co-authored-by: kemuriririn <10inspiral@gmail.com>
Co-authored-by: sunnyboxs <sjt2000@qq.com>
2025-04-18 18:09:13 +08:00
sunnyboxs
71c5295198
批次推理:修复(漏句/丢句/音频空白) (#100)
* 批次推理:重要修复(漏句/丢句/音频空白)

* 批次推理:新增数据分桶机制,增强稳定性~
2025-04-18 17:57:07 +08:00
kemuriririn
6783f22fe4
Feature/kemurin (#99)
* deepspeed无法使用时回退到通常路径

* ninja支持中文路径编译补丁:BigVGAN fused cuda kernel

* 缓存参考音频的Mel

* ninja支持中文路径编译方案2:BigVGAN fused cuda kernel

* 增加批次推理:长句实现至少 2~10 倍以上的速度提升~

* fix上层目录为空时报错

---------

Co-authored-by: kemuriririn <10inspiral@gmail.com>
Co-authored-by: sunnyboxs <sjt2000@qq.com>
2025-04-17 15:12:45 +08:00
sunnyboxs
91b7fa6148
ninja中文路径编译补丁支持:BigVGAN fused cuda kernel (#93)
* ninja支持中文路径编译补丁:BigVGAN fused cuda kernel

* 缓存参考音频的Mel

* ninja支持中文路径编译方案2:BigVGAN fused cuda kernel
2025-04-17 14:56:37 +08:00
root
b6c11dddb9 Add the calculation time of each module. 2025-04-15 12:48:47 +08:00
Yrom
94d1353e4e
enable custom cuda kernel for BigVGAN 2025-04-15 12:04:59 +08:00
kemuriririn
21a3212a34
deepspeed无法使用时回退到通常路径 (#90)
Co-authored-by: kemuriririn <10inspiral@gmail.com>
2025-04-14 20:22:57 +08:00
Yrom Wang
18c32c06b1
修复拼音问题和分句问题,支持轻音声调(如yi1 shang5) (#83)
* Update Pinyin tone handling in TextNormalizer

* Enhance sentence splitting and improve tokenizer integration in inference

* Update character replacement mappings

test: "在电影《肖申克的救赎》中,安迪·杜佛兰被错误地判处终身监禁..."

* Refactor TextNormalizer and enhance testing with additional cases
2025-04-14 19:50:36 +08:00
Yrom
879e270d39
Adds MPS support for Apple Silicon 2025-04-11 21:22:08 +08:00
Yrom
ec65755fc8
Support inference on CPU 2025-04-11 20:58:41 +08:00
Yrom
471a45435c
Add cli mode for inference 2025-04-11 20:33:54 +08:00
root
eff6eb8f43 fix bug. 2025-04-10 10:52:59 +08:00
root
702cfa905c fix long silence bug. 2025-04-09 19:53:36 +08:00
root
999cf40258 fix long silence bug. 2025-04-09 19:52:49 +08:00
root
47ec591d40 fix long silence bug. 2025-04-09 19:45:18 +08:00
shujingchen
ea9acb5ca3 Merge from main 2025-04-09 12:19:44 +08:00
shujingchen
058be6f799 Merge from main 2025-04-09 12:02:28 +08:00
root
19be5dba2d fix bug. 2025-04-09 10:38:51 +08:00
root
18e20ccbb4 enable front-end caching to speed up startup. 2025-04-09 10:35:47 +08:00
shujingchen
a649fe2bff set replace_with_kernel_inject=False as default for gpt infer 2025-04-08 16:02:26 +08:00
root
ae395dc416 cleanup code 2025-04-08 11:54:31 +08:00
boostpapa
2523001bb4 support ultra-long silence filtering 2025-04-08 11:23:11 +08:00
shujingchen
e92bf90235 DeepSpeed acceleration and FP16 inference support, but bigvgan disable 2025-04-03 16:30:39 +08:00
kemuriririn
6286b0ffc9 推理时加载bpe model使用相对于模型根目录的路径 2025-04-02 17:40:41 +08:00