Fix ignored generator in FlowMatchEulerDiscreteScheduler#13678
Open
RobbinMarcus wants to merge 1 commit intohuggingface:mainfrom
Open
Fix ignored generator in FlowMatchEulerDiscreteScheduler#13678RobbinMarcus wants to merge 1 commit intohuggingface:mainfrom
RobbinMarcus wants to merge 1 commit intohuggingface:mainfrom
Conversation
Author
|
It seems github doesn't like I had a previous repository with the same name and keeps overriding it? It's closing this automatically for some reason. Edit: skill-issue. I had a push-mirror that overwrote the whole repo. All good now. |
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
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.
What does this PR do?
FlowMatchEulerDiscreteScheduler.step()accepts a generator argument, but whenstochastic_sampling=Trueit calls plaintorch.randn_like(sample)instead of using the generator. This makes results non-deterministic even with a fixed seed.This PR replaces
torch.randn_likecall with the existingrandn_tensor(..., generator=generator, device=sample.device, dtype=sample.dtype)so the scheduler respects the passed generator in the stochastic sampling path, consistent with how other schedulers in diffusers handle randomness.I'm using z-image with
euler_ancestralwhich gave me inconsistent results, which led me to to fixing it.Simple reproduce script
Before submitting
Who can review?
Anyone in the community is free to review the PR once the tests have passed.
Core library:
(Sorry for the spam ping re-do, it looks like github overwrote main with a previous repository I had hosted under the same name.. This time it's from a branch in my fork)