Add partial diffusion (SDEdit) seeding - #2
Open
ssiddhantsharma wants to merge 2 commits into
Open
Conversation
- flow_matching.seed_state: build a partially-noised DenoiseState at a start step from a clean (bb, lat), i.e. the SDEdit analog of init_noise. - flow_matching.generate(seed=, start=): begin integration from a seeded state instead of pure noise. Backward-compatible (seed defaults to None; existing calls unchanged). - pdb.seed_from_encoder: encode a chain to a (ca_coords, z_latent) seed for generate(). - tests/test_seed.py: seeding-math endpoints, monotonicity, and a zero-velocity round-trip.
…eeding # Conflicts: # src/jproteina_complexa/flow_matching.py # src/jproteina_complexa/pdb.py
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
Adds SDEdit-style partial diffusion to the flow-matching sampler: start integration from a partially-noised copy of an existing structure instead of pure noise, to produce variants of a design rather than de-novo samples.
flow_matching.seed_state(...)— build a partially-noisedDenoiseStateat a start step from a clean(bb, lat); the SDEdit analog ofinit_noise, using the model's own linear interpolantx = t*clean + (1-t)*noise.flow_matching.generate(..., seed=None, start=0)— begin from a seeded state. Backward-compatible:seeddefaults toNone, so existing calls are unchanged.pdb.seed_from_encoder(encoder, chain)— convenience to encode a chain into a(ca_coords, z_latent)seed via the deterministic encoder.Tests
tests/test_seed.py(pure JAX, no weights): interpolant endpoints (t=1 -> clean, t=0 -> noise), monotonic closeness instart, a zero-velocitygenerate(seed=)round-trip, and thestart>0guard. All pass locally.Design choices (feedback welcome)
startis an integer step index (matchesdenoise_steps). A floatt/renoise_fracin (0,1) would be more ergonomic (caller needn't knownsteps) — happy to switch.generatewithseed/startrather than a separategenerate_partial, to keep one entry point and full backward-compat. Can split if preferred.seed_statezero-COMs only the noise, preserving whatever frame the caller passes (target-frame for conditioned SDEdit; zero-COM for unconditioned single-chain). Documented in the docstring.generate's step-0 behavior).