Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support v-prediction #25

Open
ZDisket opened this issue Feb 25, 2024 · 0 comments
Open

[Feature Request] Support v-prediction #25

ZDisket opened this issue Feb 25, 2024 · 0 comments

Comments

@ZDisket
Copy link

ZDisket commented Feb 25, 2024

Some SD finetunes (and the official Stable Diffusion 2) use v-prediction because they observe that it's better
Currently, v-prediction models will export with Olive and run fine with the ONNX diffusers pipeline, but not here. This is "a castle" on one I exported
a castle - euler unmod

I tried modifying DpmPlusPlus2MScheduler::ApplyStep by modifying the predictedOriginalSample based off one of the diffusers implementations

        auto predictedOriginalSample = output.BinaryOperation<float>(input, [currentSigma](float a, float b) {
            float sigmaSquared = currentSigma * currentSigma;
            return (a * (-currentSigma / sqrt(sigmaSquared + 1))) + (b / sqrt(sigmaSquared + 1));
            });

I could only make the result semi-coherent

In DPMPlusPlus2MScheduler, the formula from HF's euler discrete works

        auto predictedOriginalSample = output.BinaryOperation<float>(input, [currentSigma](float model_output, float sample){
            float sigmaSquaredPlusOne = currentSigma * currentSigma + 1;
            return (model_output * (-currentSigma / std::sqrt(sigmaSquaredPlusOne))) + (sample / sigmaSquaredPlusOne);
            });

a castle - dpm fix

If you could finish this (haven't figured out EulerAncestralScheduler) (I have everything here), it would greatly improve compatibility. I uploaded the model in case it's useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant