-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor sampling module with new functional submodule
#53
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open
Merged
Done - Rename SkrampleSampler -> StructuredSampler in structured module - Add FunctionalSampler and functional module - Add Heun sampler in functional module - Add StructuredFunctionalAdapter in interface module - Add UT for StructuredFunctionalAdapter - Add example for StructuredFunctionalAdapter and Heun - Move some types and functions around to dedupe code. Not Done - Plots for functional samplers - UT for Heun if diffusers behaves - Higher order Heun / Runge Kutta - Ideally RKX instead of just RK3 or RK4 - Functional integrations? - In *theory* it's possible to use FunctionalSinglestep through SkrampleWrapperScheduler by maintaining directly using `step` and doing a shitload of sketchy state management. Image2Image will 100% not work OOTB unless the pipeline actually respects `scheduler.order` which not all of them do I don't think. Alternatives involve monkey patches and sadness so I'd rather not.
…el_with_predictor
Relies on branching for transforms currently, but results are substantially better than the raw prediction based solver
The polar to/from derive functions are *so close* to working with flow
match but it's just not quite there.
So I basically have two options:
1. fix the derives so they work for any transform
2. accept defeat and replace SigmaTransform with some generic
ModelTransforms unit struct that just has static methods
for the sigma and derivative transforms
fe7ca07 to
53a230c
Compare
"Once I add velocity this can trivially go into the diffusers wrapper" yeah pretty sure it's actually impossible to write v-prediction as z̃ₛ = z̃ₜ + output · (ηₛ - ηₜ) so I rewrote it again into a custom parameterization space that actually for real works with everything and am wiping out all of the commits trying to make DiffusionFlow work Squashed commit of the following: commit 6b83bf297e87b888a65733e1ed0c95b30f21bbd0 Author: Beinsezii <[email protected]> Date: Mon Nov 17 01:11:55 2025 -0800 Rewrite ModelTransform to use custom parameterization commit 4913744 Author: Beinsezii <[email protected]> Date: Sun Nov 16 16:45:17 2025 -0800 Velocity yes depend on X commit 4373aa1 Author: Beinsezii <[email protected]> Date: Fri Nov 14 22:56:11 2025 -0800 Velocity don't depend on Epsilon commit 0d0a4c0 Author: Beinsezii <[email protected]> Date: Fri Nov 14 22:22:55 2025 -0800 Fix FlowModel to_x/from_x with VariancePreserving schedule commit d6b5971 Author: Beinsezii <[email protected]> Date: Fri Nov 14 03:49:50 2025 -0800 Make DiffusionModel the X impl commit 73a73d6 Author: Beinsezii <[email protected]> Date: Fri Nov 14 03:22:07 2025 -0800 models: Add XModel, VelocityModel, .to_x(), .from_x(), .to_h() commit 26b012a Author: Beinsezii <[email protected]> Date: Tue Nov 11 01:38:37 2025 -0800 Add unified set of Diffusion model transforms Currently just for sampling.functional Once I add velocity this can trivially go into the diffusers wrapper instead of a raw prediction function, and then moved through structured Possibly I could associate the schedule and therefore also the sigma transform `type base_schedule = Linear` or whatever. Will have to play around see if FlowModel can be made to handle a Variance-Preserving schedule and vice-versa. Just so fucking glad I don't have to switch on sigma_transform anymore for the tableau solver.
Still not 100% certain on how to best parameterize the derivative transform. It needs to be per-step for plans on making RKUltra its own diffusers wrapper, so ig adding yet another parameter™ is hot.
Since we have common.divf() now this is more appropriate
…atamodel,NoiseModel
Add unified set of Diffusion model transforms electric boogaloo
Owner
Author
|
Think I've added pretty much everything I could need for a first implementation. RKMoire and FastHeun are both crazy jank still but not sure what to do about that since diffusion is really chaotic. |
Owner
Author
|
Basically, a lot of areas need follow-ups but most of it is no longer problems with the
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
examples/diffusers/functional.pyusing Flux. The API is very rough so I will probably hold off on making this an official interface until diffusers figures out their modular system more. Maybe I should open an issue suggesting a more functional-compatible system?model(x, t)?timestepsas an arbitrary sequence and don't assume it's whole steps which would only work for Heun. It would also involve pre-building the whole schedule splattered across the tableau, including skips for T=0.