@@ -105,6 +105,7 @@ struct SDParams {
105105 float slg_scale = 0 .f;
106106 float skip_layer_start = 0 .01f ;
107107 float skip_layer_end = 0 .2f ;
108+ int shifted_timestep = -1 ;
108109
109110 bool chroma_use_dit_mask = true ;
110111 bool chroma_use_t5_mask = false ;
@@ -163,6 +164,7 @@ void print_params(SDParams params) {
163164 printf (" batch_count: %d\n " , params.batch_count );
164165 printf (" vae_tiling: %s\n " , params.vae_tiling ? " true" : " false" );
165166 printf (" upscale_repeats: %d\n " , params.upscale_repeats );
167+ printf (" timestep_shift: %d\n " , params.shifted_timestep );
166168 printf (" chroma_use_dit_mask: %s\n " , params.chroma_use_dit_mask ? " true" : " false" );
167169 printf (" chroma_use_t5_mask: %s\n " , params.chroma_use_t5_mask ? " true" : " false" );
168170 printf (" chroma_t5_mask_pad: %d\n " , params.chroma_t5_mask_pad );
@@ -223,7 +225,7 @@ void print_usage(int argc, const char* argv[]) {
223225 printf (" --rng {std_default, cuda} RNG (default: cuda)\n " );
224226 printf (" -s SEED, --seed SEED RNG seed (default: 42, use random seed for < 0)\n " );
225227 printf (" -b, --batch-count COUNT number of images to generate\n " );
226- printf (" --schedule {discrete, karras, exponential, ays, gits} Denoiser sigma schedule (default: discrete)\n " );
228+ printf (" --schedule {discrete, karras, exponential, ays, gits, sgm_uniform, simple } Denoiser sigma schedule (default: discrete)\n " );
227229 printf (" --clip-skip N ignore last layers of CLIP network; 1 ignores none, 2 ignores one layer (default: -1)\n " );
228230 printf (" <= 0 represents unspecified, will be 1 for SD1.x, 2 for SD2.x\n " );
229231 printf (" --vae-tiling process vae in tiles to reduce memory usage\n " );
@@ -235,6 +237,7 @@ void print_usage(int argc, const char* argv[]) {
235237 printf (" --control-net-cpu keep controlnet in cpu (for low vram)\n " );
236238 printf (" --canny apply canny preprocessor (edge detection)\n " );
237239 printf (" --color colors the logging tags according to level\n " );
240+ printf (" --timestep-shift N shift timestep for NitroFusion models, default: -1 off, recommended N for NitroSD-Realism around 250 and 500 for NitroSD-Vibrant\n " );
238241 printf (" --chroma-disable-dit-mask disable dit mask for chroma\n " );
239242 printf (" --chroma-enable-t5-mask enable t5 mask for chroma\n " );
240243 printf (" --chroma-t5-mask-pad PAD_SIZE t5 mask pad size of chroma\n " );
@@ -487,7 +490,7 @@ void parse_args(int argc, const char** argv, SDParams& params) {
487490 const char * arg = argv[index];
488491 params.schedule = str_to_schedule (arg);
489492 if (params.schedule == SCHEDULE_COUNT) {
490- fprintf (stderr, " error: invalid schedule %s\n " ,
493+ fprintf (stderr, " error: invalid schedule %s, must be one of [discrete, karras, exponential, ays, gits, sgm_uniform, simple] \n " ,
491494 arg);
492495 return -1 ;
493496 }
@@ -568,7 +571,18 @@ void parse_args(int argc, const char** argv, SDParams& params) {
568571 {" -r" , " --ref-image" , " " , on_ref_image_arg},
569572 {" -h" , " --help" , " " , on_help_arg},
570573 };
571-
574+ auto on_timestep_shift_arg = [&](int argc, const char ** argv, int index) {
575+ if (++index >= argc) {
576+ return -1 ;
577+ }
578+ params.shifted_timestep = std::stoi (argv[index]);
579+ if (params.shifted_timestep != -1 && (params.shifted_timestep < 1 || params.shifted_timestep > 1000 )) {
580+ fprintf (stderr, " error: timestep-shift must be between 1 and 1000, or -1 to disable\n " );
581+ return -1 ;
582+ }
583+ return 1 ;
584+ };
585+ options.manual_options .push_back ({" " , " --timestep-shift" , " " , on_timestep_shift_arg});
572586 if (!parse_options (argc, argv, options)) {
573587 print_usage (argc, argv);
574588 exit (1 );
@@ -979,6 +993,7 @@ int main(int argc, const char* argv[]) {
979993 params.style_ratio ,
980994 params.normalize_input ,
981995 params.input_id_images_path .c_str (),
996+ params.shifted_timestep ,
982997 };
983998
984999 results = generate_image (sd_ctx, &img_gen_params);
0 commit comments