-
Notifications
You must be signed in to change notification settings - Fork 12k
llama-tts : add -o option #12042
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
llama-tts : add -o option #12042
Conversation
common/arg.cpp
Outdated
@@ -1858,13 +1858,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex | |||
? params.lora_outfile.c_str() | |||
: ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR | |||
? params.cvector_outfile.c_str() | |||
: params.out_file.c_str()), | |||
: ex == LLAMA_EXAMPLE_TTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's now time to convert this block into if..else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ngxson Hi, could you pls have a look a the changes see if they are ok ? MAny thanks..
common/common.h
Outdated
std::string | ||
lora_outfile = "ggml-lora-merged-f16.gguf", | ||
ttss_outfile = "output.wav"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string | |
lora_outfile = "ggml-lora-merged-f16.gguf", | |
ttss_outfile = "output.wav"; | |
std::string lora_outfile = "ggml-lora-merged-f16.gguf"; | |
std::string ttss_outfile = "output.wav"; |
examples/tts/tts.cpp
Outdated
@@ -963,11 +964,18 @@ lovely<|t_0.56|><|code_start|><|634|><|596|><|1766|><|1556|><|1306|><|1285|><|14 | |||
LOG_INF("%s: time for spectral ops: %.3f ms\n", __func__, (ggml_time_us() - t_spec_start) / 1000.0f); | |||
LOG_INF("%s: total time: %.3f ms\n", __func__, (ggml_time_us() - t_main_start) / 1000.0f); | |||
|
|||
save_wav16(fname, audio, n_sr); | |||
int retval(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int retval(0); | |
int retval = 0; |
examples/tts/tts.cpp
Outdated
} | ||
|
||
else { | ||
retval=ENOENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
else { | |
retval=ENOENT; | |
} else { | |
retval = ENOENT; |
common/arg.cpp
Outdated
|
||
// retrieving the right default output filename, | ||
// depending on the example program... | ||
std::string * out_file_ptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string * out_file_ptr; | |
const char * default_out_file; |
And also change the rest to match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ngxson thank you, all changes done and committed on this PR.
* arg.cpp : refactored default output fname if/else block * codestyle alignments in this PR (ggml-org#12042)
common/arg.cpp
Outdated
if (ex == LLAMA_EXAMPLE_EXPORT_LORA) | ||
default_out_file = params.lora_outfile.c_str(); | ||
else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR) | ||
default_out_file = params.cvector_outfile.c_str(); | ||
else if (ex == LLAMA_EXAMPLE_TTS) | ||
default_out_file = params.ttss_outfile.c_str(); | ||
else // currently coded as "imatrix.dat", see common.h | ||
default_out_file = params.out_file.c_str(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ex == LLAMA_EXAMPLE_EXPORT_LORA) | |
default_out_file = params.lora_outfile.c_str(); | |
else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR) | |
default_out_file = params.cvector_outfile.c_str(); | |
else if (ex == LLAMA_EXAMPLE_TTS) | |
default_out_file = params.ttss_outfile.c_str(); | |
else // currently coded as "imatrix.dat", see common.h | |
default_out_file = params.out_file.c_str(); | |
if (ex == LLAMA_EXAMPLE_EXPORT_LORA) { | |
default_out_file = params.lora_outfile.c_str(); | |
} else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR) { | |
default_out_file = params.cvector_outfile.c_str(); | |
} else if (ex == LLAMA_EXAMPLE_TTS) { | |
default_out_file = params.ttss_outfile.c_str(); | |
} else // currently coded as "imatrix.dat", see common.h | |
default_out_file = params.out_file.c_str(); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, committed.
common/common.h
Outdated
std::string lora_outfile = "ggml-lora-merged-f16.gguf"; | ||
std::string ttss_outfile = "output.wav"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be simpler to just have a single std::string outfile;
parameter that is used by all examples to output things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I see that this requires some changes also in cvector-generator and export-lora. If ok for you I refactor this, perhaps with a dedicated PR ?
examples/tts/tts.cpp
Outdated
if (save_wav16(params.out_file, audio, n_sr)) { | ||
LOG_INF("%s: audio written to file '%s'\n", __func__, params.out_file.c_str()); | ||
} else { | ||
retval=ENOENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retval=ENOENT; | |
retval = ENOENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, committed.
As discussed in PR 'llama-tts : add -o option' (ggml-org#12042): * common_params : 'out_file' string is the only output file name parameter left in common_params. It's intended to be used in all example programs implementing an '-o' option. * cvector-generator, export-lora, imatrix : default output filenames moved from 'common_params' to the 'main()' of each example program.
As discussed in PR 'llama-tts : add -o option' (#12042): * common_params : 'out_file' string is the only output file name parameter left in common_params. It's intended to be used in all example programs implementing an '-o' option. * cvector-generator, export-lora, imatrix : default output filenames moved from 'common_params' to the 'main()' of each example program.
@ggerganov Good morning, thank you for approving/merging the PR 'Refactoring -o option' (#12278). After the merge, many of the commits of this PR are obsolete. Is it ok for you if I open a new PR for implementing the '-o' on llama-tts? |
Yes you can either open a new PR or fix commit using |
As discussed in PR 'llama-tts : add -o option' (ggml-org#12042): * common_params : 'out_file' string is the only output file name parameter left in common_params. It's intended to be used in all example programs implementing an '-o' option. * cvector-generator, export-lora, imatrix : default output filenames moved from 'common_params' to the 'main()' of each example program.
* added -o option to specify an output file name * llama-tts returns ENOENT in case of file write error note : PR ggml-org#12042 is closed as superseded with this one.
* added -o option to specify an output file name * llama-tts returns ENOENT in case of file write error note : PR #12042 is closed as superseded with this one.
As discussed in PR 'llama-tts : add -o option' (ggml-org#12042): * common_params : 'out_file' string is the only output file name parameter left in common_params. It's intended to be used in all example programs implementing an '-o' option. * cvector-generator, export-lora, imatrix : default output filenames moved from 'common_params' to the 'main()' of each example program.
* added -o option to specify an output file name * llama-tts returns ENOENT in case of file write error note : PR ggml-org#12042 is closed as superseded with this one.
enabled optional cmdline argument '-o' on tts to specify an output filename. It defaults to 'output.wav'.
program now returns ENOENT in case of file write failure