| 536 | } |
| 537 | |
| 538 | int main(int argc, char ** argv) { |
| 539 | common_params params; |
| 540 | |
| 541 | params.out_file = "output.wav"; |
| 542 | params.prompt = ""; |
| 543 | |
| 544 | params.n_predict = 4096; |
| 545 | params.n_batch = 8192; |
| 546 | params.n_ctx = 8192; |
| 547 | |
| 548 | params.sampling.top_k = 4; |
| 549 | params.sampling.samplers = { COMMON_SAMPLER_TYPE_TOP_K, }; |
| 550 | |
| 551 | if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_TTS, print_usage)) { |
| 552 | return 1; |
| 553 | } |
| 554 | |
| 555 | const int n_parallel = params.n_parallel; |
| 556 | const int n_predict = params.n_predict; |
| 557 | |
| 558 | common_init(); |
| 559 | |
| 560 | // init LLM |
| 561 | |
| 562 | llama_backend_init(); |
| 563 | llama_numa_init(params.numa); |
| 564 | |
| 565 | llama_model * model_ttc = NULL; // text-to-codes |
| 566 | llama_model * model_cts = NULL; // codes-to-speech |
| 567 | |
| 568 | llama_context * ctx_ttc = NULL; |
| 569 | llama_context * ctx_cts = NULL; |
| 570 | |
| 571 | auto llama_init_ttc = common_init_from_params(params); |
| 572 | |
| 573 | model_ttc = llama_init_ttc->model(); |
| 574 | ctx_ttc = llama_init_ttc->context(); |
| 575 | |
| 576 | if (model_ttc == nullptr || ctx_ttc == nullptr) { |
| 577 | return ENOENT; |
| 578 | } |
| 579 | |
| 580 | const llama_vocab * vocab = llama_model_get_vocab(model_ttc); |
| 581 | |
| 582 | params.model = params.vocoder.model; |
| 583 | params.embedding = true; |
| 584 | params.n_ubatch = params.n_batch; |
| 585 | |
| 586 | auto llama_init_cts = common_init_from_params(params); |
| 587 | |
| 588 | model_cts = llama_init_cts->model(); |
| 589 | ctx_cts = llama_init_cts->context(); |
| 590 | |
| 591 | if (model_cts == nullptr || ctx_cts == nullptr) { |
| 592 | return ENOENT; |
| 593 | } |
| 594 | |
| 595 | std::vector<common_sampler *> smpl(n_parallel); |
nothing calls this directly
no test coverage detected