@@ -1851,16 +1851,27 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
18511851 params.i_pos = value;
18521852 }
18531853 ).set_examples ({LLAMA_EXAMPLE_PASSKEY}));
1854+
1855+ // retrieving the right default output filename,
1856+ // depending on the example program...
1857+ std::string * out_file_ptr;
1858+
1859+ if (ex == LLAMA_EXAMPLE_EXPORT_LORA)
1860+ out_file_ptr = & params.lora_outfile ;
1861+
1862+ else if (ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR)
1863+ out_file_ptr = & params.cvector_outfile ;
1864+
1865+ else if (ex == LLAMA_EXAMPLE_TTS)
1866+ out_file_ptr = & params.ttss_outfile ;
1867+
1868+ else // currently coded as "imatrix.dat", see common.h
1869+ out_file_ptr = & params.out_file ;
1870+
18541871 add_opt (common_arg (
18551872 {" -o" , " --output" , " --output-file" }, " FNAME" ,
18561873 string_format (" output file (default: '%s')" ,
1857- ex == LLAMA_EXAMPLE_EXPORT_LORA
1858- ? params.lora_outfile .c_str ()
1859- : ex == LLAMA_EXAMPLE_CVECTOR_GENERATOR
1860- ? params.cvector_outfile .c_str ()
1861- : ex == LLAMA_EXAMPLE_TTS
1862- ? params.ttss_outfile .c_str ()
1863- : params.out_file .c_str ()),
1874+ out_file_ptr->c_str ()),
18641875 [](common_params & params, const std::string & value) {
18651876 params.out_file = value;
18661877 params.cvector_outfile = value;
0 commit comments