feat: denoise strength as starting noise level (#1738)

This commit is contained in:
stduhpf
2026-07-05 10:24:46 +02:00
committed by GitHub
parent 38a51f8105
commit c60b36af0f
2 changed files with 60 additions and 3 deletions

View File

@@ -1013,6 +1013,7 @@ struct Denoiser {
const sd::Tensor<float>& latent) = 0;
virtual sd::Tensor<float> inverse_noise_scaling(float sigma,
const sd::Tensor<float>& latent) = 0;
virtual float noise_level_to_sigma(float noise_level) = 0;
virtual std::vector<float> get_sigmas(uint32_t n, int image_seq_len, scheduler_t scheduler_type, SDVersion version, const char* extra_sample_args = nullptr) {
auto bound_t_to_sigma = std::bind(&Denoiser::t_to_sigma, this, std::placeholders::_1);
@@ -1160,6 +1161,10 @@ struct CompVisDenoiser : public Denoiser {
SD_UNUSED(sigma);
return latent;
}
float noise_level_to_sigma(float noise_level) {
return noise_level / (1.0f - noise_level);
}
};
struct CompVisVDenoiser : public CompVisDenoiser {
@@ -1247,6 +1252,10 @@ struct DiscreteFlowDenoiser : public Denoiser {
sd::Tensor<float> inverse_noise_scaling(float sigma, const sd::Tensor<float>& latent) override {
return latent * (1.0f / (1.0f - sigma));
}
float noise_level_to_sigma(float noise_level) {
return noise_level;
}
};
struct FluxFlowDenoiser : public DiscreteFlowDenoiser {
@@ -1384,6 +1393,11 @@ struct MiniT2IFlowDenoiser : public Denoiser {
return latent;
}
float noise_level_to_sigma(float noise_level) {
SD_UNUSED(noise_level);
return 1.0f;
}
std::vector<float> get_sigmas(uint32_t n, int image_seq_len, scheduler_t scheduler_type, SDVersion version, const char* extra_sample_args = nullptr) override {
SD_UNUSED(image_seq_len);
SD_UNUSED(scheduler_type);