mirror of
https://github.com/index-tts/index-tts.git
synced 2026-09-17 17:39:13 +08:00
fix: Fix QwenEmotion crash when json.loads returns string-valued emotion scores (#719)
* Initial plan * Fix clamp_score to handle string emotion values from json.loads * Add warning log for non-numeric emotion scores in clamp_score * Raise ValueError on non-numeric emotion scores to abort TTS inference --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -763,6 +763,13 @@ class QwenEmotion:
|
||||
self.min_score = 0.0
|
||||
|
||||
def clamp_score(self, value):
|
||||
try:
|
||||
value = float(value)
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValueError(
|
||||
f"QwenEmotion returned a non-numeric emotion score {value!r}. "
|
||||
"Please retry the request."
|
||||
) from exc
|
||||
return max(self.min_score, min(self.max_score, value))
|
||||
|
||||
def convert(self, content):
|
||||
|
||||
Reference in New Issue
Block a user