Skip to content

Commit 39dad6d

Browse files
committed
fix: improve mode help text, add missing edit mode
1 parent cca2e4e commit 39dad6d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

examples/cli/main.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const char* modes_str[] = {
6060
"edit",
6161
"convert",
6262
};
63+
#define SD_ALL_MODES_STR "txt2img, img2img, edit, convert"
6364

6465
enum SDMode {
6566
TXT2IMG,
@@ -199,7 +200,11 @@ void print_usage(int argc, const char* argv[]) {
199200
printf("\n");
200201
printf("arguments:\n");
201202
printf(" -h, --help show this help message and exit\n");
202-
printf(" -M, --mode [MODEL] run mode (txt2img or img2img or convert, default: txt2img)\n");
203+
printf(" -M, --mode [MODE] run mode, one of:\n");
204+
printf(" txt2img: generate an image from a text prompt (default)\n");
205+
printf(" img2img: generate an image from a text prompt and an initial image (--init-img)\n");
206+
printf(" edit: modify an image (--ref-image) based on text instructions\n");
207+
printf(" convert: convert a model file to gguf format, optionally with quantization\n");
203208
printf(" -t, --threads N number of threads to use during computation (default: -1)\n");
204209
printf(" If threads <= 0, then threads will be set to the number of CPU physical cores\n");
205210
printf(" -m, --model [MODEL] path to full model\n");
@@ -291,8 +296,8 @@ void parse_args(int argc, const char** argv, SDParams& params) {
291296
}
292297
if (mode_found == -1) {
293298
fprintf(stderr,
294-
"error: invalid mode %s, must be one of [txt2img, img2img, img2vid, convert]\n",
295-
mode_selected);
299+
"error: invalid mode %s, must be one of [%s]\n",
300+
mode_selected, SD_ALL_MODES_STR);
296301
exit(1);
297302
}
298303
params.mode = (SDMode)mode_found;
@@ -1218,4 +1223,4 @@ int main(int argc, const char* argv[]) {
12181223
free(input_image_buffer);
12191224

12201225
return 0;
1221-
}
1226+
}

0 commit comments

Comments
 (0)