feat: concatenate repeated cli arg strings (#1686)

This commit is contained in:
stduhpf 2026-06-21 18:24:13 +02:00 committed by GitHub
parent e9e952462f
commit 2bd249c971
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 60 additions and 4 deletions

View File

@ -62,18 +62,22 @@ struct SDCliParams {
{"-o", {"-o",
"--output", "--output",
"path to write result image to. you can use printf-style %d format specifiers for image sequences (default: ./output.png) (eg. output_%03d.png). Single-file video outputs support .avi, .webm, and animated .webp", "path to write result image to. you can use printf-style %d format specifiers for image sequences (default: ./output.png) (eg. output_%03d.png). Single-file video outputs support .avi, .webm, and animated .webp",
0,
&output_path}, &output_path},
{"", {"",
"--image", "--image",
"path to the image to inspect (for metadata mode)", "path to the image to inspect (for metadata mode)",
0,
&image_path}, &image_path},
{"", {"",
"--metadata-format", "--metadata-format",
"metadata output format, one of [text, json] (default: text)", "metadata output format, one of [text, json] (default: text)",
0,
&metadata_format}, &metadata_format},
{"", {"",
"--preview-path", "--preview-path",
"path to write preview image to (default: ./preview.png). Multi-frame previews support .avi, .webm, and animated .webp", "path to write preview image to (default: ./preview.png). Multi-frame previews support .avi, .webm, and animated .webp",
0,
&preview_path}, &preview_path},
}; };

View File

@ -260,7 +260,14 @@ bool parse_options(int argc, const char** argv, const std::vector<ArgOptions>& o
invalid_arg = true; invalid_arg = true;
return; return;
} }
*option.target = argv_to_utf8(i, argv); if(option.concat && !option.target->empty()){
if(option.concat > 0 && option.concat <= 0xff){
*option.target += static_cast<char>(option.concat);
}
*option.target += argv_to_utf8(i, argv);
} else {
*option.target = argv_to_utf8(i, argv);
}
found_arg = true; found_arg = true;
})) }))
break; break;
@ -324,120 +331,151 @@ ArgOptions SDContextParams::get_options() {
{"-m", {"-m",
"--model", "--model",
"path to full model", "path to full model",
0,
&model_path}, &model_path},
{"", {"",
"--clip_l", "--clip_l",
"path to the clip-l text encoder", &clip_l_path}, "path to the clip-l text encoder",
0,
&clip_l_path},
{"", "--clip_g", {"", "--clip_g",
"path to the clip-g text encoder", "path to the clip-g text encoder",
0,
&clip_g_path}, &clip_g_path},
{"", {"",
"--clip_vision", "--clip_vision",
"path to the clip-vision encoder", "path to the clip-vision encoder",
0,
&clip_vision_path}, &clip_vision_path},
{"", {"",
"--t5xxl", "--t5xxl",
"path to the t5xxl text encoder", "path to the t5xxl text encoder",
0,
&t5xxl_path}, &t5xxl_path},
{"", {"",
"--llm", "--llm",
"path to the llm text encoder. For example: (qwenvl2.5 for qwen-image, mistral-small3.2 for flux2, ...)", "path to the llm text encoder. For example: (qwenvl2.5 for qwen-image, mistral-small3.2 for flux2, ...)",
0,
&llm_path}, &llm_path},
{"", {"",
"--llm_vision", "--llm_vision",
"path to the llm vit", "path to the llm vit",
0,
&llm_vision_path}, &llm_vision_path},
{"", {"",
"--qwen2vl", "--qwen2vl",
"alias of --llm. Deprecated.", "alias of --llm. Deprecated.",
0,
&llm_path}, &llm_path},
{"", {"",
"--qwen2vl_vision", "--qwen2vl_vision",
"alias of --llm_vision. Deprecated.", "alias of --llm_vision. Deprecated.",
0,
&llm_vision_path}, &llm_vision_path},
{"", {"",
"--diffusion-model", "--diffusion-model",
"path to the standalone diffusion model", "path to the standalone diffusion model",
0,
&diffusion_model_path}, &diffusion_model_path},
{"", {"",
"--high-noise-diffusion-model", "--high-noise-diffusion-model",
"path to the standalone high noise diffusion model", "path to the standalone high noise diffusion model",
0,
&high_noise_diffusion_model_path}, &high_noise_diffusion_model_path},
{"", {"",
"--uncond-diffusion-model", "--uncond-diffusion-model",
"path to the standalone unconditional diffusion model, currently used by Ideogram4 CFG", "path to the standalone unconditional diffusion model, currently used by Ideogram4 CFG",
0,
&uncond_diffusion_model_path}, &uncond_diffusion_model_path},
{"", {"",
"--embeddings-connectors", "--embeddings-connectors",
"path to LTXAV embeddings connectors", "path to LTXAV embeddings connectors",
0,
&embeddings_connectors_path}, &embeddings_connectors_path},
{"", {"",
"--vae", "--vae",
"path to standalone vae model", "path to standalone vae model",
0,
&vae_path}, &vae_path},
{"", {"",
"--vae-format", "--vae-format",
"VAE latent format override: auto, flux, sd3, or flux2 (default: auto)", "VAE latent format override: auto, flux, sd3, or flux2 (default: auto)",
0,
&vae_format}, &vae_format},
{"", {"",
"--audio-vae", "--audio-vae",
"path to standalone LTX audio vae model", "path to standalone LTX audio vae model",
0,
&audio_vae_path}, &audio_vae_path},
{"", {"",
"--taesd", "--taesd",
"path to taesd. Using Tiny AutoEncoder for fast decoding (low quality)", "path to taesd. Using Tiny AutoEncoder for fast decoding (low quality)",
0,
&taesd_path}, &taesd_path},
{"", {"",
"--tae", "--tae",
"alias of --taesd", "alias of --taesd",
0,
&taesd_path}, &taesd_path},
{"", {"",
"--control-net", "--control-net",
"path to control net model", "path to control net model",
0,
&control_net_path}, &control_net_path},
{"", {"",
"--embd-dir", "--embd-dir",
"embeddings directory", "embeddings directory",
0,
&embedding_dir}, &embedding_dir},
{"", {"",
"--lora-model-dir", "--lora-model-dir",
"lora model directory", "lora model directory",
0,
&lora_model_dir}, &lora_model_dir},
{"", {"",
"--hires-upscalers-dir", "--hires-upscalers-dir",
"highres fix upscaler model directory", "highres fix upscaler model directory",
0,
&hires_upscalers_dir}, &hires_upscalers_dir},
{"", {"",
"--tensor-type-rules", "--tensor-type-rules",
"weight type per tensor pattern (example: \"^vae\\.=f16,model\\.=q8_0\")", "weight type per tensor pattern (example: \"^vae\\.=f16,model\\.=q8_0\")",
(int)',',
&tensor_type_rules}, &tensor_type_rules},
{"", {"",
"--photo-maker", "--photo-maker",
"path to PHOTOMAKER model", "path to PHOTOMAKER model",
0,
&photo_maker_path}, &photo_maker_path},
{"", {"",
"--pulid-weights", "--pulid-weights",
"path to PuLID Flux weights", "path to PuLID Flux weights",
0,
&pulid_weights_path}, &pulid_weights_path},
{"", {"",
"--upscale-model", "--upscale-model",
"path to esrgan model.", "path to esrgan model.",
0,
&esrgan_path}, &esrgan_path},
{"", {"",
"--backend", "--backend",
"runtime backend assignment, e.g. cpu or clip=cpu,vae=cuda0,diffusion=vulkan0", "runtime backend assignment, e.g. cpu or clip=cpu,vae=cuda0,diffusion=vulkan0",
(int)',',
&backend}, &backend},
{"", {"",
"--params-backend", "--params-backend",
"parameter backend assignment, e.g. disk, cpu, or diffusion=disk,clip=cpu", "parameter backend assignment, e.g. disk, cpu, or diffusion=disk,clip=cpu",
(int)',',
&params_backend}, &params_backend},
{"", {"",
"--rpc-servers", "--rpc-servers",
"comma-separated list of RPC servers to connect to for offloading, in the format host:port, e.g. localhost:50052,192.168.1.3:50052", "comma-separated list of RPC servers to connect to for offloading, in the format host:port, e.g. localhost:50052,192.168.1.3:50052",
(int)',',
&rpc_servers}, &rpc_servers},
{"", {"",
"--max-vram", "--max-vram",
"maximum VRAM budget in GiB for graph-cut segmented execution. Accepts a single value or assignments by backend/device, e.g. 6 or cuda0=6,vulkan0=4. 0 disables graph splitting; a negative value auto-detects free VRAM, sparing the specified value", "maximum VRAM budget in GiB for graph-cut segmented execution. Accepts a single value or assignments by backend/device, e.g. 6 or cuda0=6,vulkan0=4. 0 disables graph splitting; a negative value auto-detects free VRAM, sparing the specified value",
0,
&max_vram}, &max_vram},
}; };
@ -857,58 +895,71 @@ ArgOptions SDGenerationParams::get_options() {
{"-p", {"-p",
"--prompt", "--prompt",
"the prompt to render", "the prompt to render",
0,
&prompt}, &prompt},
{"-n", {"-n",
"--negative-prompt", "--negative-prompt",
"the negative prompt (default: \"\")", "the negative prompt (default: \"\")",
0,
&negative_prompt}, &negative_prompt},
{"-i", {"-i",
"--init-img", "--init-img",
"path to the init image", "path to the init image",
0,
&init_image_path}, &init_image_path},
{"", {"",
"--end-img", "--end-img",
"path to the end image, required by flf2v", "path to the end image, required by flf2v",
0,
&end_image_path}, &end_image_path},
{"", {"",
"--mask", "--mask",
"path to the mask image", "path to the mask image",
0,
&mask_image_path}, &mask_image_path},
{"", {"",
"--control-image", "--control-image",
"path to control image, control net", "path to control image, control net",
0,
&control_image_path}, &control_image_path},
{"", {"",
"--control-video", "--control-video",
"path to control video frames, It must be a directory path. The video frames inside should be stored as images in " "path to control video frames, It must be a directory path. The video frames inside should be stored as images in "
"lexicographical (character) order. For example, if the control video path is `frames`, the directory contain images " "lexicographical (character) order. For example, if the control video path is `frames`, the directory contain images "
"such as 00.png, 01.png, ... etc.", "such as 00.png, 01.png, ... etc.",
0,
&control_video_path}, &control_video_path},
{"", {"",
"--pm-id-images-dir", "--pm-id-images-dir",
"path to PHOTOMAKER input id images dir", "path to PHOTOMAKER input id images dir",
0,
&pm_id_images_dir}, &pm_id_images_dir},
{"", {"",
"--pm-id-embed-path", "--pm-id-embed-path",
"path to PHOTOMAKER v2 id embed", "path to PHOTOMAKER v2 id embed",
0,
&pm_id_embed_path}, &pm_id_embed_path},
{"", {"",
"--pulid-id-embedding", "--pulid-id-embedding",
"path to PuLID id embedding", "path to PuLID id embedding",
0,
&pulid_id_embedding_path}, &pulid_id_embedding_path},
{"", {"",
"--hires-upscaler", "--hires-upscaler",
"highres fix upscaler, Lanczos, Nearest, Latent, Latent (nearest), Latent (nearest-exact), " "highres fix upscaler, Lanczos, Nearest, Latent, Latent (nearest), Latent (nearest-exact), "
"Latent (antialiased), Latent (bicubic), Latent (bicubic antialiased), or a model name " "Latent (antialiased), Latent (bicubic), Latent (bicubic antialiased), or a model name "
"under --hires-upscalers-dir (default: Latent)", "under --hires-upscalers-dir (default: Latent)",
0,
&hires_upscaler}, &hires_upscaler},
{"", {"",
"--extra-sample-args", "--extra-sample-args",
"extra sampler/scheduler/guidance args, key=value list. APG supports apg_eta, apg_momentum, apg_norm_threshold, apg_norm_threshold_smoothing; SLG supports slg_uncond; lcm supports noise_clip_std, noise_scale_start, noise_scale_end; ltx2 supports max_shift, base_shift, stretch, terminal; euler_ge supports gamma", "extra sampler/scheduler/guidance args, key=value list. APG supports apg_eta, apg_momentum, apg_norm_threshold, apg_norm_threshold_smoothing; SLG supports slg_uncond; lcm supports noise_clip_std, noise_scale_start, noise_scale_end; ltx2 supports max_shift, base_shift, stretch, terminal; euler_ge supports gamma",
(int)',',
&extra_sample_args}, &extra_sample_args},
{"", {"",
"--extra-tiling-args", "--extra-tiling-args",
"extra VAE tiling args, key=value list. LTX video VAE supports temporal_tile_frames (default: 4), temporal_tile_overlap (default: 1)", "extra VAE tiling args, key=value list. LTX video VAE supports temporal_tile_frames (default: 4), temporal_tile_overlap (default: 1)",
(int)',',
&extra_tiling_args}, &extra_tiling_args},
}; };

View File

@ -31,6 +31,7 @@ struct StringOption {
std::string short_name; std::string short_name;
std::string long_name; std::string long_name;
std::string desc; std::string desc;
int concat;
std::string* target; std::string* target;
}; };

View File

@ -190,8 +190,8 @@ ArgOptions SDSvrParams::get_options() {
ArgOptions options; ArgOptions options;
options.string_options = { options.string_options = {
{"-l", "--listen-ip", "server listen ip (default: 127.0.0.1)", &listen_ip}, {"-l", "--listen-ip", "server listen ip (default: 127.0.0.1)", 0, &listen_ip},
{"", "--serve-html-path", "path to HTML file to serve at root (optional)", &serve_html_path}, {"", "--serve-html-path", "path to HTML file to serve at root (optional)", 0, &serve_html_path},
}; };
options.int_options = { options.int_options = {