Skip to content

Commit ecc230b

Browse files
Fix: create files with unique names
1 parent 4864d6b commit ecc230b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/eval-callback/eval-callback.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ static bool run(llama_context * ctx, const common_params & params, callback_data
148148
int main(int argc, char **argv) {
149149
std::string output_prefix = "default";
150150

151-
prompt_output_file.open(output_prefix + "_prompt_output.txt");
152-
tensor_output_file.open(output_prefix + "_tensor_output.txt");
153-
154151

155152
if (!prompt_output_file || !tensor_output_file) {
156153
std::cerr << "❌ Failed to open output files.\n";
@@ -222,7 +219,13 @@ int main(int argc, char **argv) {
222219
filtered_argv.push_back(argv[i]);
223220
}
224221

222+
prompt_output_file.open(output_prefix + "_prompt_output.txt");
223+
tensor_output_file.open(output_prefix + "_tensor_output.txt");
225224

225+
if (!prompt_output_file || !tensor_output_file) {
226+
std::cerr << "❌ Failed to open output files.\n";
227+
return 1;
228+
}
226229

227230
if (!common_params_parse((int)filtered_argv.size(), filtered_argv.data(), params, LLAMA_EXAMPLE_COMMON)) {
228231
return 1;

0 commit comments

Comments
 (0)