Repository navigation
moss_image: the schedule from scheduler_config.json natively, bit for bit MOSSImageScheduler's - #1670
Open
BobClawblaw wants to merge 2 commits into
Open
BobClawblaw wants to merge 2 commits into
BobClawblaw wants to merge 2 commits into
Conversation
…orch.randn's on any CPU The pipeline starts from torch.randn on a CPU generator seeded with manual_seed. moss_image.noise computes those latents in the family's host code: torch's mt19937 and its float uniforms, then the Box-Muller pass over 16 values that x86 torch takes, with avx_mathfun.h's log and sincos and their multiply-adds fused as GCC fuses them in torch's build. ARM torch takes a libm path, so its bits differ from x86 torch's in the last places (for seed 42 at 1024x1024, 200,873 of 524,288 values on a Mac, by at most 2.2e-6). The native generator gives x86 torch's bits on every CPU. moss_image_case.py noise records sha256s of x86 torch's latents (torch 2.13.0, AVX512) for 24 seeds and 9 sizes, 69 cases, in the case's rows x columns x 128 layout; zig build test checks every one. Host code only: no kernels and no shared code.
… bit MOSSImageScheduler's moss_image.schedule computes the timesteps and noise levels the pipeline's MOSSImageScheduler sets: a float32 grid shifted by `shift`, snapped to the nearest of the `num_train_timesteps` training levels (shifted by `training_shift`), repeats dropped, sigmas ending at 0. torch.linspace's CPU kernel fuses its multiply-add, and so does this. A config turning on Karras, exponential or beta sigmas, dynamic shifting, shift_terminal, inverted sigmas or stochastic sampling is refused: diffusers warns it ignores them, but its base scheduler applies them. moss_image_case.py schedule records sha256s of the scheduler's own timesteps and sigmas for 21 step counts (1 to 2000) and 5 configs; zig build test checks all 105. torch gives the same bits on x86, a GB10 and a Mac.
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.
Part of #1529. Builds on #1668: its first commit is #1668's.
moss_image.schedulecomputes the timesteps and noise levels that the pipeline'sMOSSImageSchedulersets:shift;num_train_timestepstraining levels, which are shifted bytraining_shift;torch's CPU
linspacefuses its multiply-add, and so does this; unfused, 850 of 897 test grids differ from torch.Config: it reads the three settings above. It refuses a config that turns on Karras, exponential or beta sigmas, dynamic shifting,
shift_terminal, inverted sigmas or stochastic sampling. diffusers warns that MOSSImageScheduler ignores those keys, but I checked and its base scheduler applies them.Checks
moss_image_case.py schedulerecords sha256s of the scheduler's own timesteps and sigmas: 21 step counts from 1 to 2000, times 5 configs (the released one,shift3.0 and 7.5,training_shift2.0,num_train_timesteps500).zig build testchecks all 105, on aarch64 and on x86.linspacefails the test.Not in this PR
The issue's third item, gating
tf-moss-image's teacher check per step against float32. It builds on #1512's gate code and needs a Mac run with float32 references for every step, so it follows once #1512 lands. Switchingtf-moss-imagefrom the case's schedule to this one belongs with #1531.Host code only, with no kernels and no shared code. lean shows 0 new problems.