@@ -60,6 +60,7 @@ const char* sampling_methods_str[] = {
6060 " DDIM \" trailing\" " ,
6161 " TCD" ,
6262 " Euler A" ,
63+ " Gradient Estimation" ,
6364};
6465
6566/* ================================================== Helper Functions ================================================*/
@@ -1481,6 +1482,7 @@ class StableDiffusionGGML {
14811482 float eta,
14821483 int shifted_timestep,
14831484 sample_method_t method,
1485+ float ge_gamma,
14841486 const std::vector<float >& sigmas,
14851487 int start_merge_step,
14861488 SDCondition id_cond,
@@ -1836,7 +1838,7 @@ class StableDiffusionGGML {
18361838 return denoised;
18371839 };
18381840
1839- sample_k_diffusion (method, denoise, work_ctx, x, sigmas, sampler_rng, eta);
1841+ sample_k_diffusion (method, denoise, work_ctx, x, sigmas, sampler_rng, eta, ge_gamma );
18401842
18411843 if (easycache_enabled) {
18421844 size_t total_steps = sigmas.size () > 0 ? sigmas.size () - 1 : 0 ;
@@ -2288,6 +2290,7 @@ const char* sample_method_to_str[] = {
22882290 " ddim_trailing" ,
22892291 " tcd" ,
22902292 " euler_a" ,
2293+ " gradient_estimation" ,
22912294};
22922295
22932296const char * sd_sample_method_name (enum sample_method_t sample_method) {
@@ -2518,6 +2521,7 @@ void sd_sample_params_init(sd_sample_params_t* sample_params) {
25182521 sample_params->scheduler = DEFAULT;
25192522 sample_params->sample_method = SAMPLE_METHOD_DEFAULT;
25202523 sample_params->sample_steps = 20 ;
2524+ sample_params->ge_gamma = 2 .0f ;
25212525}
25222526
25232527char * sd_sample_params_to_str (const sd_sample_params_t * sample_params) {
@@ -2538,6 +2542,7 @@ char* sd_sample_params_to_str(const sd_sample_params_t* sample_params) {
25382542 " sample_method: %s, "
25392543 " sample_steps: %d, "
25402544 " eta: %.2f, "
2545+ " ge_gamma: %.2f, "
25412546 " shifted_timestep: %d)" ,
25422547 sample_params->guidance .txt_cfg ,
25432548 std::isfinite (sample_params->guidance .img_cfg )
@@ -2552,6 +2557,7 @@ char* sd_sample_params_to_str(const sd_sample_params_t* sample_params) {
25522557 sd_sample_method_name (sample_params->sample_method ),
25532558 sample_params->sample_steps ,
25542559 sample_params->eta ,
2560+ sample_params->ge_gamma ,
25552561 sample_params->shifted_timestep );
25562562
25572563 return buf;
@@ -2695,6 +2701,7 @@ sd_image_t* generate_image_internal(sd_ctx_t* sd_ctx,
26952701 int width,
26962702 int height,
26972703 enum sample_method_t sample_method,
2704+ float ge_gamma,
26982705 const std::vector<float >& sigmas,
26992706 int64_t seed,
27002707 int batch_count,
@@ -2990,6 +2997,7 @@ sd_image_t* generate_image_internal(sd_ctx_t* sd_ctx,
29902997 eta,
29912998 shifted_timestep,
29922999 sample_method,
3000+ ge_gamma,
29933001 sigmas,
29943002 start_merge_step,
29953003 id_cond,
@@ -3305,6 +3313,7 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx, const sd_img_gen_params_t* sd_img_g
33053313 width,
33063314 height,
33073315 sample_method,
3316+ sd_img_gen_params->sample_params .ge_gamma ,
33083317 sigmas,
33093318 seed,
33103319 sd_img_gen_params->batch_count ,
@@ -3632,6 +3641,7 @@ SD_API sd_image_t* generate_video(sd_ctx_t* sd_ctx, const sd_vid_gen_params_t* s
36323641 sd_vid_gen_params->high_noise_sample_params .eta ,
36333642 sd_vid_gen_params->high_noise_sample_params .shifted_timestep ,
36343643 sd_vid_gen_params->high_noise_sample_params .sample_method ,
3644+ sd_vid_gen_params->high_noise_sample_params .ge_gamma ,
36353645 high_noise_sigmas,
36363646 -1 ,
36373647 {},
@@ -3669,6 +3679,7 @@ SD_API sd_image_t* generate_video(sd_ctx_t* sd_ctx, const sd_vid_gen_params_t* s
36693679 sd_vid_gen_params->sample_params .eta ,
36703680 sd_vid_gen_params->sample_params .shifted_timestep ,
36713681 sd_vid_gen_params->sample_params .sample_method ,
3682+ sd_vid_gen_params->sample_params .ge_gamma ,
36723683 sigmas,
36733684 -1 ,
36743685 {},
0 commit comments