From feba5010137460ec8decaba2603da7819cb963e6 Mon Sep 17 00:00:00 2001 From: Arcitec <38923130+Arcitec@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:35:17 +0200 Subject: [PATCH] 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. --- indextts/infer_v2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/indextts/infer_v2.py b/indextts/infer_v2.py index 3ab0861..7c5484c 100644 --- a/indextts/infer_v2.py +++ b/indextts/infer_v2.py @@ -603,17 +603,17 @@ class QwenEmotion: ) self.prompt = "文本情感分类" self.convert_dict = { - "愤怒": "angry", "高兴": "happy", - "恐惧": "fear", - "反感": "hate", + "愤怒": "angry", "悲伤": "sad", - "低落": "low", - "惊讶": "surprise", - "自然": "neutral", + "恐惧": "afraid", + "反感": "disgusted", + "低落": "melancholic", + "惊讶": "surprised", + "自然": "calm", } - self.backup_dict = {"happy": 0, "angry": 0, "sad": 0, "fear": 0, "hate": 0, "low": 0, "surprise": 0, - "neutral": 1.0} + self.backup_dict = {"happy": 0, "angry": 0, "sad": 0, "afraid": 0, "disgusted": 0, "melancholic": 0, + "surprised": 0, "calm": 1.0} self.max_score = 1.2 self.min_score = 0.0