@@ -1865,16 +1865,27 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
18651865 params.i_pos = value;
18661866 }
18671867 ).set_examples ({LLAMA_EXAMPLE_PASSKEY}));
1868+
1869+ // retrieving the right default output filename,
1870+ // depending on the example program...
1871+ std::string * out_file_ptr;
1872+
1873+ if (ex == LLAMA_EXAMPLE_EXPORT_LORA)
1874+ out_file_ptr = & params.lora_outfile ;
1875+
1876+ else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR)
1877+ out_file_ptr = & params.cvector_outfile ;
1878+
1879+ else if (ex == LLAMA_EXAMPLE_TTS)
1880+ out_file_ptr = & params.ttss_outfile ;
1881+
1882+ else // currently coded as "imatrix.dat", see common.h
1883+ out_file_ptr = & params.out_file ;
1884+
18681885 add_opt (common_arg (
18691886 {" -o" , " --output" , " --output-file" }, " FNAME" ,
18701887 string_format (" output file (default: '%s')" ,
1871- ex == LLAMA_EXAMPLE_EXPORT_LORA
1872- ? params.lora_outfile .c_str ()
1873- : ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR
1874- ? params.cvector_outfile .c_str ()
1875- : ex == LLAMA_EXAMPLE_TTS
1876- ? params.ttss_outfile .c_str ()
1877- : params.out_file .c_str ()),
1888+ out_file_ptr->c_str ()),
18781889 [](common_params & params, const std::string & value) {
18791890 params.out_file = value;
18801891 params.cvector_outfile = value;
0 commit comments