Skip to content

llama-tts : avoid crashes related to bad model file paths #12482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/tts/tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ int main(int argc, char ** argv) {
model_ttc = llama_init_ttc.model.get();
ctx_ttc = llama_init_ttc.context.get();

if (model_ttc == nullptr || ctx_ttc == nullptr) {
return ENOENT;
}

const llama_vocab * vocab = llama_model_get_vocab(model_ttc);

// TODO: refactor in a common struct
Expand All @@ -586,6 +590,10 @@ int main(int argc, char ** argv) {
model_cts = llama_init_cts.model.get();
ctx_cts = llama_init_cts.context.get();

if (model_cts == nullptr || ctx_cts == nullptr) {
return ENOENT;
}

std::vector<common_sampler *> smpl(n_parallel);
for (int i = 0; i < n_parallel; ++i) {
params.sampling.no_perf = (i != 0);
Expand Down
Loading