Fix "split_with_sizes(): argument 'split_sizes' (position 2)" error when using cuda

This commit is contained in:
Deniz Şafak
2025-04-29 15:00:20 +03:00
parent 0a7d352209
commit 7c55a6f6fa
+5 -2
View File
@@ -4,8 +4,11 @@ from constants import VOICES_INTERNAL
# Calls parsing and loads the voice to gpu or cpu # Calls parsing and loads the voice to gpu or cpu
def get_new_voice(pipeline, formula, use_gpu): def get_new_voice(pipeline, formula, use_gpu):
try: try:
weighted_voice = parse_voice_formula(pipeline, formula) weighted_voice = parse_voice_formula(pipeline, formula)
device = "cuda" if use_gpu else "cpu" # device = "cuda" if use_gpu else "cpu"
# Setting the device "cuda" gives "Error occurred: split_with_sizes(): argument 'split_sizes' (position 2)"
# error when the device is gpu. So disabling this for now.
device = "cpu"
return weighted_voice.to(device) return weighted_voice.to(device)
except Exception as e: except Exception as e:
raise ValueError(f"Failed to create voice: {str(e)}") raise ValueError(f"Failed to create voice: {str(e)}")