Commit f454181
committed
feat(cli): add --model-type parameter for manual version override
Adds a new --model-type CLI parameter that allows users to manually specify
the model version instead of relying on auto-detection. This is useful when:
- Auto-detection fails or is ambiguous
- Testing model behavior with different version settings
- Working with modified/custom models
Usage:
--model-type sdxl # Force SDXL version
--model-type sd1 # Force SD 1.x version
--model-type flux # Force FLUX version
Supported values: sd1, sd2, sdxl, sdxl_inpaint, sdxl_pix2pix, flux, sd3, svd
Implementation:
- Added version_override field to sd_ctx_params_t struct
- Added model_type string parameter to SDContextParams
- Added string-to-enum conversion in to_sd_ctx_params_t()
- Updated model loading to check for manual override before auto-detection
- Auto-detection still works when --model-type is not specified
Testing:
- Tested manual override with --model-type sdxl (works)
- Tested auto-detection without parameter (still works)
- Tested with SD 1.5 model and --model-type sd1 (works)
Files changed:
- stable-diffusion.h: Added version_override field to sd_ctx_params_t
- stable-diffusion.cpp: Added version override logic and initialization
- examples/common/common.hpp: Added CLI parameter and string-to-enum conversion1 parent f6ae111 commit f454181
File tree
3 files changed
+57
-9
lines changed- examples/common
- include
- src
3 files changed
+57
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
| 448 | + | |
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
| |||
487 | 490 | | |
488 | 491 | | |
489 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
490 | 497 | | |
491 | 498 | | |
492 | 499 | | |
| |||
944 | 951 | | |
945 | 952 | | |
946 | 953 | | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
947 | 986 | | |
948 | 987 | | |
949 | 988 | | |
| |||
969 | 1008 | | |
970 | 1009 | | |
971 | 1010 | | |
| 1011 | + | |
972 | 1012 | | |
973 | 1013 | | |
974 | 1014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
339 | 345 | | |
340 | 346 | | |
341 | 347 | | |
| |||
2925 | 2931 | | |
2926 | 2932 | | |
2927 | 2933 | | |
| 2934 | + | |
2928 | 2935 | | |
2929 | 2936 | | |
2930 | 2937 | | |
| |||
0 commit comments