Skip to content

Commit 6eefd2d

Browse files
authored
feat: support random seed flag (#1163)
1 parent 4ff2c8c commit 6eefd2d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/server/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,18 @@ void parse_args(int argc, const char** argv, SDSvrParams& svr_params, SDContextP
202202
exit(svr_params.normal_exit ? 0 : 1);
203203
}
204204

205+
const bool random_seed_requested = default_gen_params.seed < 0;
206+
205207
if (!svr_params.process_and_check() ||
206208
!ctx_params.process_and_check(IMG_GEN) ||
207209
!default_gen_params.process_and_check(IMG_GEN, ctx_params.lora_model_dir)) {
208210
print_usage(argc, argv, options_vec);
209211
exit(1);
210212
}
213+
214+
if (random_seed_requested) {
215+
default_gen_params.seed = -1;
216+
}
211217
}
212218

213219
std::string extract_and_remove_sd_cpp_extra_args(std::string& text) {

0 commit comments

Comments
 (0)