Skip to content

Commit b69a721

Browse files
committed
llama-tts : add -o option
* arg.cpp : refactored default output fname if/else block * codestyle alignments in this PR (#12042)
1 parent 1b9a536 commit b69a721

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

common/arg.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,24 +1868,21 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
18681868

18691869
// retrieving the right default output filename,
18701870
// depending on the example program...
1871-
std::string * out_file_ptr;
1871+
const char * default_out_file;
18721872

18731873
if (ex == LLAMA_EXAMPLE_EXPORT_LORA)
1874-
out_file_ptr = & params.lora_outfile;
1875-
1874+
default_out_file = params.lora_outfile.c_str();
18761875
else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR)
1877-
out_file_ptr = & params.cvector_outfile;
1878-
1876+
default_out_file = params.cvector_outfile.c_str();
18791877
else if (ex == LLAMA_EXAMPLE_TTS)
1880-
out_file_ptr = & params.ttss_outfile;
1881-
1878+
default_out_file = params.ttss_outfile.c_str();
18821879
else // currently coded as "imatrix.dat", see common.h
1883-
out_file_ptr = & params.out_file;
1880+
default_out_file = params.out_file.c_str();
18841881

18851882
add_opt(common_arg(
18861883
{"-o", "--output", "--output-file"}, "FNAME",
18871884
string_format("output file (default: '%s')",
1888-
out_file_ptr->c_str()),
1885+
default_out_file),
18891886
[](common_params & params, const std::string & value) {
18901887
params.out_file = value;
18911888
params.cvector_outfile = value;

common/common.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,8 @@ struct common_params {
427427
bool spm_infill = false; // suffix/prefix/middle pattern for infill
428428

429429
// default output filenames
430-
std::string
431-
lora_outfile = "ggml-lora-merged-f16.gguf",
432-
ttss_outfile = "output.wav";
430+
std::string lora_outfile = "ggml-lora-merged-f16.gguf";
431+
std::string ttss_outfile = "output.wav";
433432

434433
// batched-bench params
435434
bool batched_bench_output_jsonl = false;

examples/tts/tts.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,13 +1073,11 @@ lovely<|t_0.56|><|code_start|><|634|><|596|><|1766|><|1556|><|1306|><|1285|><|14
10731073
LOG_INF("%s: time for spectral ops: %.3f ms\n", __func__, (ggml_time_us() - t_spec_start) / 1000.0f);
10741074
LOG_INF("%s: total time: %.3f ms\n", __func__, (ggml_time_us() - t_main_start) / 1000.0f);
10751075

1076-
int retval(0);
1076+
int retval = 0;
10771077

10781078
if (save_wav16(params.out_file, audio, n_sr)) {
10791079
LOG_INF("%s: audio written to file '%s'\n", __func__, params.out_file.c_str());
1080-
}
1081-
1082-
else {
1080+
} else {
10831081
retval=ENOENT;
10841082
LOG_ERR("Check path exists, directory write permissions, free disk space.\n");
10851083
}

0 commit comments

Comments
 (0)