@@ -1040,7 +1040,8 @@ static sd::Tensor<float> sample_dpmpp_2m_v2(denoise_cb_t model,
10401040static sd::Tensor<float > sample_lcm (denoise_cb_t model,
10411041 sd::Tensor<float > x,
10421042 const std::vector<float >& sigmas,
1043- std::shared_ptr<RNG > rng) {
1043+ std::shared_ptr<RNG > rng,
1044+ bool is_flow_denoiser) {
10441045 int steps = static_cast <int >(sigmas.size ()) - 1 ;
10451046 for (int i = 0 ; i < steps; i++) {
10461047 auto denoised_opt = model (x, sigmas[i], i + 1 );
@@ -1049,6 +1050,9 @@ static sd::Tensor<float> sample_lcm(denoise_cb_t model,
10491050 }
10501051 x = std::move (denoised_opt);
10511052 if (sigmas[i + 1 ] > 0 ) {
1053+ if (is_flow_denoiser) {
1054+ x *= (1 - sigmas[i + 1 ]);
1055+ }
10521056 x += sd::Tensor<float >::randn_like (x, rng) * sigmas[i + 1 ];
10531057 }
10541058 }
@@ -1437,7 +1441,7 @@ static sd::Tensor<float> sample_k_diffusion(sample_method_t method,
14371441 case DPMPP2Mv2_SAMPLE_METHOD:
14381442 return sample_dpmpp_2m_v2 (model, std::move (x), sigmas);
14391443 case LCM_SAMPLE_METHOD :
1440- return sample_lcm (model, std::move (x), sigmas, rng);
1444+ return sample_lcm (model, std::move (x), sigmas, rng, is_flow_denoiser );
14411445 case IPNDM_SAMPLE_METHOD :
14421446 return sample_ipndm (model, std::move (x), sigmas);
14431447 case IPNDM_V_SAMPLE_METHOD :
0 commit comments