Giter VIP home page Giter VIP logo

schedulers's Issues

DPM sampler problem

@GuiyeC
Is the DPM++ SDE Karras algorithm of this project different from other's DPM++ SDE Karras algorithms such as ComfyUI?

  • Current project's DPM++ SDE Karras, SDXL, 20 steps:
    1

  • Other's DPM++ SDE Karras, SDXL, 12 steps:
    2

DPM++ 2m Karras also has problem.
For the turbo model, DPM++ SDE Karras seems to work normally, but in comparison, it requires 2-3 more steps.

add SDXL support to DPM Solver++

hello @GuiyeC
The apple/ml-stable-diffusion project has added SDXL support to DPMSolverMultistepScheduler some time ago.
apple/ml-stable-diffusion@94814cf

At present, only EulerA is compatible with SDXL in Guernika, and other schedulers have different degrees of image quality problems.
Hope you can fix the problem of DPM Solver++ for SDXL.

Optimized timesteps from nvidia

Recently, I saw the research report of nvidia. https://research.nvidia.com/labs/toronto-ai/AlignYourSteps/

  • I experimented on GuernikaKit, and the effect is really great. Maybe can add it to GuernikaKit, and diffusers have also supported it.
  • The original step is 10 steps, and I added interpolation to support more or less steps.
  • After testing, DMP++ 2M and Euler A have achieved good results. The normal SDXL model can even get good texture details in just 5 steps. The turbo, lightning hybrid lora models can also use this timesteps.

The following is my test code, but the schedulers package lacks variables to judge the model type:

	// https://github.com/GuernikaCore/Schedulers/blob/1f517514d679e38bb9915c3a74bf04f75d5b5875/Sources/Schedulers/DPMSolverMultistepScheduler.swift#L96
        // sd1.5  [999, 850, 736, 645, 545, 455, 343, 233, 124, 24]
        let alignSteps = [999, 845, 730, 587, 443, 310, 193, 116, 53, 13]
        timeSteps = DPMSolverMultistepScheduler.logInterpolation(steps: alignSteps, desiredCount: stepCount).map { Double($0) }
    // https://github.com/GuernikaCore/Schedulers/blob/1f517514d679e38bb9915c3a74bf04f75d5b5875/Sources/Schedulers/Base/Scheduler.swift#L133
    static func logInterpolation(steps: [Int], desiredCount: Int) -> [Int] {
        var interpolatedSteps = [Int]()
        let logSteps = steps.map { log(Double($0)) }
        let stepSize = Double(logSteps.count - 1) / Double(desiredCount - 1)
        for i in 0..<desiredCount {
            let index = Double(i) * stepSize
            let lowerIndex = Int(floor(index))
            let upperIndex = Int(ceil(index))
            
            if lowerIndex == upperIndex {
                interpolatedSteps.append(steps[lowerIndex])
            } else {
                let lowerValue = logSteps[lowerIndex]
                let upperValue = logSteps[upperIndex]
                let fraction = index - Double(lowerIndex)
                let interpolatedValue = exp(lowerValue + fraction * (upperValue - lowerValue))
                interpolatedSteps.append(Int(interpolatedValue))
            }
        }
        return interpolatedSteps
    }

The following is the normal SDXL comparison test (DMP++ 2M optimized-timesteps and DMP++ 2M karras, 6 steps)
1
2

Convert other schedulers?

Is it possible to convert other schedulers that are not available on this repo, like DDPM 3M for ex?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.