Skip to content

Commit ea7ddd0

Browse files
author
LittleMouse
committed
[update] Add CosyVoice tokenizer server timeout
1 parent 50e3609 commit ea7ddd0

File tree

1 file changed

+9
-3
lines changed
  • projects/llm_framework/main_cosy_voice/src/runner/Tokenizer

1 file changed

+9
-3
lines changed

projects/llm_framework/main_cosy_voice/src/runner/Tokenizer/Tokenizer.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,17 @@ class Tokenizer_Http : public BaseTokenizer {
349349
bool Init(std::string model_path = "http://localhost:8080", bool b_bos = true, bool b_eos = false) override
350350
{
351351
base_url = model_path;
352+
if (!test_connect_http(base_url, 20)) {
353+
ALOGE("connect %s failed", base_url.c_str());
354+
return false;
355+
} else {
356+
ALOGI("connect %s ok", base_url.c_str());
357+
}
352358
try {
353359
cli = std::make_shared<httplib::Client>(base_url);
354-
cli->set_connection_timeout(1);
355-
cli->set_read_timeout(1);
356-
cli->set_write_timeout(1);
360+
cli->set_connection_timeout(10);
361+
cli->set_read_timeout(10);
362+
cli->set_write_timeout(10);
357363
{
358364
auto ret = cli->Get("/bos_id");
359365
auto rep = ret.value();

0 commit comments

Comments
 (0)