liumaolin
commited on
Commit
·
3d953ae
1
Parent(s):
516d7b8
Remove unused configuration parameters and conversation templates.
Browse files
src/VoiceDialogue/main.py
CHANGED
|
@@ -24,8 +24,7 @@ def launch_system(
|
|
| 24 |
user_language: str,
|
| 25 |
system_prompt: str,
|
| 26 |
tts_speaker: str,
|
| 27 |
-
llm: typing.Literal['7B', '14B'] = '14B'
|
| 28 |
-
whisper_model: typing.Literal['medium', 'large'] = 'medium'
|
| 29 |
):
|
| 30 |
audio_frames_queue = Queue()
|
| 31 |
user_voice_queue = Queue()
|
|
@@ -123,10 +122,8 @@ def main():
|
|
| 123 |
tts_speaker = '沈逸'
|
| 124 |
# QWen2.5 7B or 14B
|
| 125 |
llm = '14B'
|
| 126 |
-
# Whisper medium or large
|
| 127 |
-
whisper_model = 'medium'
|
| 128 |
|
| 129 |
-
launch_system(user_language, SYSTEM_PROMPT, tts_speaker, llm=llm
|
| 130 |
|
| 131 |
|
| 132 |
if __name__ == '__main__':
|
|
|
|
| 24 |
user_language: str,
|
| 25 |
system_prompt: str,
|
| 26 |
tts_speaker: str,
|
| 27 |
+
llm: typing.Literal['7B', '14B'] = '14B'
|
|
|
|
| 28 |
):
|
| 29 |
audio_frames_queue = Queue()
|
| 30 |
user_voice_queue = Queue()
|
|
|
|
| 122 |
tts_speaker = '沈逸'
|
| 123 |
# QWen2.5 7B or 14B
|
| 124 |
llm = '14B'
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
launch_system(user_language, SYSTEM_PROMPT, tts_speaker, llm=llm)
|
| 127 |
|
| 128 |
|
| 129 |
if __name__ == '__main__':
|
src/VoiceDialogue/models/voice_model.py
CHANGED
|
@@ -50,22 +50,6 @@ VOICE_MODEL_CONFIGS = (
|
|
| 50 |
'fragment_interval': 0.07,
|
| 51 |
'seed': 233333,
|
| 52 |
},
|
| 53 |
-
'conversation_templates': {
|
| 54 |
-
"opening_remarks": [
|
| 55 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 56 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 57 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 58 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 59 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 60 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 61 |
-
],
|
| 62 |
-
"mid_responses": [
|
| 63 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 64 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 65 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 66 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 67 |
-
]
|
| 68 |
-
}
|
| 69 |
},
|
| 70 |
{
|
| 71 |
'repository': 'MoYoYoTech/tone-models',
|
|
@@ -98,22 +82,6 @@ VOICE_MODEL_CONFIGS = (
|
|
| 98 |
'fragment_interval': 0.07,
|
| 99 |
'seed': 233333,
|
| 100 |
},
|
| 101 |
-
'conversation_templates': {
|
| 102 |
-
"opening_remarks": [
|
| 103 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 104 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 105 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 106 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 107 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 108 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 109 |
-
],
|
| 110 |
-
"mid_responses": [
|
| 111 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 112 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 113 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 114 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 115 |
-
]
|
| 116 |
-
}
|
| 117 |
},
|
| 118 |
{
|
| 119 |
'repository': 'MoYoYoTech/tone-models',
|
|
@@ -145,22 +113,6 @@ VOICE_MODEL_CONFIGS = (
|
|
| 145 |
'fragment_interval': 0.07,
|
| 146 |
'seed': 233333,
|
| 147 |
},
|
| 148 |
-
'conversation_templates': {
|
| 149 |
-
"opening_remarks": [
|
| 150 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 151 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 152 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 153 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 154 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 155 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 156 |
-
],
|
| 157 |
-
"mid_responses": [
|
| 158 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 159 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 160 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 161 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 162 |
-
]
|
| 163 |
-
}
|
| 164 |
},
|
| 165 |
{
|
| 166 |
'repository': 'MoYoYoTech/tone-models',
|
|
@@ -193,22 +145,6 @@ VOICE_MODEL_CONFIGS = (
|
|
| 193 |
'fragment_interval': 0.07,
|
| 194 |
'seed': 233333,
|
| 195 |
},
|
| 196 |
-
'conversation_templates': {
|
| 197 |
-
"opening_remarks": [
|
| 198 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 199 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 200 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 201 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 202 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 203 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 204 |
-
],
|
| 205 |
-
"mid_responses": [
|
| 206 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 207 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 208 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 209 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 210 |
-
]
|
| 211 |
-
}
|
| 212 |
},
|
| 213 |
{
|
| 214 |
'repository': 'MoYoYoTech/tone-models',
|
|
@@ -241,22 +177,6 @@ VOICE_MODEL_CONFIGS = (
|
|
| 241 |
'fragment_interval': 0.07,
|
| 242 |
'seed': 233333,
|
| 243 |
},
|
| 244 |
-
'conversation_templates': {
|
| 245 |
-
"opening_remarks": [
|
| 246 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 247 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 248 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 249 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 250 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 251 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 252 |
-
],
|
| 253 |
-
"mid_responses": [
|
| 254 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 255 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 256 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 257 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 258 |
-
]
|
| 259 |
-
}
|
| 260 |
},
|
| 261 |
{
|
| 262 |
'repository': 'MoYoYoTech/tone-models',
|
|
@@ -289,71 +209,7 @@ VOICE_MODEL_CONFIGS = (
|
|
| 289 |
'fragment_interval': 0.07,
|
| 290 |
'seed': 233333,
|
| 291 |
},
|
| 292 |
-
'conversation_templates': {
|
| 293 |
-
"opening_remarks": [
|
| 294 |
-
"To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 295 |
-
"Before we begin here today, I should say that it’s nice to meet you.",
|
| 296 |
-
"First off, I just wanted to thank you for coming out and contributing a question.",
|
| 297 |
-
"Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 298 |
-
"Hey, how’s it going? We’ve got some important things to cover today.",
|
| 299 |
-
"Good to be here. We’ve got a lot of important topics to discuss."
|
| 300 |
-
],
|
| 301 |
-
"mid_responses": [
|
| 302 |
-
"Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 303 |
-
"More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 304 |
-
"Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 305 |
-
"Well, you've brought something to the table, and that's what dialogue is all about."
|
| 306 |
-
]
|
| 307 |
-
}
|
| 308 |
},
|
| 309 |
-
# {
|
| 310 |
-
# 'repository': 'MoYoYoTech/gpt-sovits-models',
|
| 311 |
-
# 'character_name': 'ShenTeng',
|
| 312 |
-
# 'cover_image': '',
|
| 313 |
-
# 'description': '',
|
| 314 |
-
# 'file_size': '240M',
|
| 315 |
-
# 'is_chinese_voice': True,
|
| 316 |
-
# 'model_files': {
|
| 317 |
-
# 'gpt-weights': 'GPT_weights/shenteng_best_gpt.ckpt',
|
| 318 |
-
# 'sovits-weights': 'SoVITS_weights/shenteng_best_sovits.pth',
|
| 319 |
-
# 'prompt_semantic_path': 'shenteng_prompt_semantic.pt',
|
| 320 |
-
# 'refer_spepc_path': 'shenteng_spec.pt',
|
| 321 |
-
# 'text_features_path': 'text_features.pth',
|
| 322 |
-
# 'reference_audio': '',
|
| 323 |
-
# 'bert_base_path': 'chinese-roberta-wwm-ext-large'
|
| 324 |
-
# },
|
| 325 |
-
# 'inference_parameters': {
|
| 326 |
-
# 'text_lang': "zh",
|
| 327 |
-
# 'prompt_text': "",
|
| 328 |
-
# 'prompt_lang': "zh",
|
| 329 |
-
# 'top_k': 5,
|
| 330 |
-
# 'top_p': 1,
|
| 331 |
-
# 'temperature': 1,
|
| 332 |
-
# 'text_split_method': "cut3",
|
| 333 |
-
# 'batch_size': 100,
|
| 334 |
-
# 'speed_factor': 1.0,
|
| 335 |
-
# 'split_bucket': True,
|
| 336 |
-
# 'return_fragment': False,
|
| 337 |
-
# 'fragment_interval': 0.07,
|
| 338 |
-
# 'seed': 233333,
|
| 339 |
-
# },
|
| 340 |
-
# 'conversation_templates': {
|
| 341 |
-
# "opening_remarks": [
|
| 342 |
-
# "To start off, I just want to say that it’s nice to be talking to you here today.",
|
| 343 |
-
# "Before we begin here today, I should say that it’s nice to meet you.",
|
| 344 |
-
# "First off, I just wanted to thank you for coming out and contributing a question.",
|
| 345 |
-
# "Great to be here with you. I’m looking forward to a fantastic discussion.",
|
| 346 |
-
# "Hey, how’s it going? We’ve got some important things to cover today.",
|
| 347 |
-
# "Good to be here. We’ve got a lot of important topics to discuss."
|
| 348 |
-
# ],
|
| 349 |
-
# "mid_responses": [
|
| 350 |
-
# "Okay, you've got something on your mind, and that's why we're here, isn't it?",
|
| 351 |
-
# "More and more people are asking about this, and I’ve got somthing on my mind.",
|
| 352 |
-
# "Everybody's talking about this, and frankly, they're right to talk about it.",
|
| 353 |
-
# "Well, you've brought something to the table, and that's what dialogue is all about."
|
| 354 |
-
# ]
|
| 355 |
-
# }
|
| 356 |
-
# },
|
| 357 |
)
|
| 358 |
|
| 359 |
|
|
@@ -381,7 +237,7 @@ class VoiceModel(BaseModel):
|
|
| 381 |
is_chinese_voice: bool
|
| 382 |
model_files: dict[str, str]
|
| 383 |
inference_parameters: dict[str, typing.Any]
|
| 384 |
-
conversation_templates: ConversationTemplates
|
| 385 |
|
| 386 |
_download_status: VoiceModelStatus = VoiceModelStatus.NOT_DOWNLOADED
|
| 387 |
|
|
|
|
| 50 |
'fragment_interval': 0.07,
|
| 51 |
'seed': 233333,
|
| 52 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
},
|
| 54 |
{
|
| 55 |
'repository': 'MoYoYoTech/tone-models',
|
|
|
|
| 82 |
'fragment_interval': 0.07,
|
| 83 |
'seed': 233333,
|
| 84 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
},
|
| 86 |
{
|
| 87 |
'repository': 'MoYoYoTech/tone-models',
|
|
|
|
| 113 |
'fragment_interval': 0.07,
|
| 114 |
'seed': 233333,
|
| 115 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
},
|
| 117 |
{
|
| 118 |
'repository': 'MoYoYoTech/tone-models',
|
|
|
|
| 145 |
'fragment_interval': 0.07,
|
| 146 |
'seed': 233333,
|
| 147 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
},
|
| 149 |
{
|
| 150 |
'repository': 'MoYoYoTech/tone-models',
|
|
|
|
| 177 |
'fragment_interval': 0.07,
|
| 178 |
'seed': 233333,
|
| 179 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
},
|
| 181 |
{
|
| 182 |
'repository': 'MoYoYoTech/tone-models',
|
|
|
|
| 209 |
'fragment_interval': 0.07,
|
| 210 |
'seed': 233333,
|
| 211 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
)
|
| 214 |
|
| 215 |
|
|
|
|
| 237 |
is_chinese_voice: bool
|
| 238 |
model_files: dict[str, str]
|
| 239 |
inference_parameters: dict[str, typing.Any]
|
| 240 |
+
# conversation_templates: ConversationTemplates
|
| 241 |
|
| 242 |
_download_status: VoiceModelStatus = VoiceModelStatus.NOT_DOWNLOADED
|
| 243 |
|
src/VoiceDialogue/services/audio/audio_answer.py
CHANGED
|
@@ -43,8 +43,8 @@ class TTSAudioGenerator(BaseThread):
|
|
| 43 |
'vits_weights_path': voice_role.sovits_weights_path,
|
| 44 |
'cnhuhbert_base_path': voice_role.hubert_model_path,
|
| 45 |
'bert_base_path': voice_role.bert_model_path,
|
| 46 |
-
'prompt_semantic_path': voice_role.prompt_semantic_path,
|
| 47 |
-
'refer_spec_path': voice_role.reference_spec_path,
|
| 48 |
}
|
| 49 |
}
|
| 50 |
tts_config = TTS_Config(config)
|
|
|
|
| 43 |
'vits_weights_path': voice_role.sovits_weights_path,
|
| 44 |
'cnhuhbert_base_path': voice_role.hubert_model_path,
|
| 45 |
'bert_base_path': voice_role.bert_model_path,
|
| 46 |
+
# 'prompt_semantic_path': voice_role.prompt_semantic_path,
|
| 47 |
+
# 'refer_spec_path': voice_role.reference_spec_path,
|
| 48 |
}
|
| 49 |
}
|
| 50 |
tts_config = TTS_Config(config)
|
third_party/moyoyo_tts/TTS_infer_pack/TTS.py
CHANGED
|
@@ -152,8 +152,8 @@ class TTS_Config:
|
|
| 152 |
self.version = version
|
| 153 |
self.t2s_weights_path = self.configs.get("t2s_weights_path", None)
|
| 154 |
self.vits_weights_path = self.configs.get("vits_weights_path", None)
|
| 155 |
-
self.prompt_semantic_path = self.configs.get('prompt_semantic_path')
|
| 156 |
-
self.refer_spec_path = self.configs.get('refer_spec_path')
|
| 157 |
self.bert_base_path = self.configs.get("bert_base_path", None)
|
| 158 |
os.environ['bert_path'] = f'{self.bert_base_path}'
|
| 159 |
self.cnhuhbert_base_path = self.configs.get("cnhuhbert_base_path", None)
|
|
@@ -175,13 +175,13 @@ class TTS_Config:
|
|
| 175 |
self.cnhuhbert_base_path = self.default_configs[default_config_key]['cnhuhbert_base_path']
|
| 176 |
print(f"fall back to default cnhuhbert_base_path: {self.cnhuhbert_base_path}")
|
| 177 |
|
| 178 |
-
if (self.prompt_semantic_path in [None, ""]) or (not os.path.exists(self.prompt_semantic_path)):
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
if (self.refer_spec_path in [None, ""]) or (not os.path.exists(self.refer_spec_path)):
|
| 183 |
-
|
| 184 |
-
|
| 185 |
|
| 186 |
self.update_configs()
|
| 187 |
|
|
|
|
| 152 |
self.version = version
|
| 153 |
self.t2s_weights_path = self.configs.get("t2s_weights_path", None)
|
| 154 |
self.vits_weights_path = self.configs.get("vits_weights_path", None)
|
| 155 |
+
# self.prompt_semantic_path = self.configs.get('prompt_semantic_path')
|
| 156 |
+
# self.refer_spec_path = self.configs.get('refer_spec_path')
|
| 157 |
self.bert_base_path = self.configs.get("bert_base_path", None)
|
| 158 |
os.environ['bert_path'] = f'{self.bert_base_path}'
|
| 159 |
self.cnhuhbert_base_path = self.configs.get("cnhuhbert_base_path", None)
|
|
|
|
| 175 |
self.cnhuhbert_base_path = self.default_configs[default_config_key]['cnhuhbert_base_path']
|
| 176 |
print(f"fall back to default cnhuhbert_base_path: {self.cnhuhbert_base_path}")
|
| 177 |
|
| 178 |
+
# if (self.prompt_semantic_path in [None, ""]) or (not os.path.exists(self.prompt_semantic_path)):
|
| 179 |
+
# self.prompt_semantic_path = self.default_configs['prompt_semantic_path']
|
| 180 |
+
# print(f"fall back to default prompt_semantic_path: {self.prompt_semantic_path}")
|
| 181 |
+
#
|
| 182 |
+
# if (self.refer_spec_path in [None, ""]) or (not os.path.exists(self.refer_spec_path)):
|
| 183 |
+
# self.refer_spec_path = self.default_configs['refer_spec_path']
|
| 184 |
+
# print(f"fall back to default refer_spec_path: {self.refer_spec_path}")
|
| 185 |
|
| 186 |
self.update_configs()
|
| 187 |
|