feat: Implement linear and cosine beta schedules#22
Open
KrishanYadav333 wants to merge 1 commit intoML4SCI:mainfrom
Open
feat: Implement linear and cosine beta schedules#22KrishanYadav333 wants to merge 1 commit intoML4SCI:mainfrom
KrishanYadav333 wants to merge 1 commit intoML4SCI:mainfrom
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
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.
Pre-GSoC groundwork for the "Denoising Astronomical Observations
of Protoplanetary Disks" project (GSoC 2026).
Third PR in the groundwork series, following the config system and
model skeleton. This one is purely math — no model code touched.
Implemented the two beta schedules that control how noise is added
during the forward diffusion process:
as used in the original DDPM paper (Ho et al., 2020)
avoids adding too much noise too quickly at the start
Also precomputes all the derived tensors needed downstream
(alphas, alphas_cumprod, sqrt variants) and implements q_sample —
the closed-form forward diffusion step:
x_t = sqrt(ᾱ_t) * x_0 + sqrt(1 - ᾱ_t) * ε
p_sample and p_sample_loop are still stubs — those need the U-Net
which is coming in the next PR.
36 unit tests covering schedule shapes, value ranges,
monotonicity, q_sample output, and invalid input validation.
Files changed:
src/models/noise_scheduler.pytests/test_noise_scheduler.py