Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
75afe88
enable mps and remove tree visualizations for now
annh3 Apr 5, 2026
a626cb0
remove tree visualizations
annh3 Apr 5, 2026
f696271
add veloicty epsilon predictor converter notebok
annh3 Apr 5, 2026
69d5085
add ddpm sampler for sd1.5
annh3 Apr 5, 2026
f5ce10c
add remark about cfg
annh3 Apr 5, 2026
f38079d
add todos
annh3 Apr 5, 2026
caf8984
correction
annh3 Apr 6, 2026
e5c5421
add velocity ddim sampler
annh3 Apr 6, 2026
451ce56
clean up schedulers and sample with velocity reparameterization
annh3 Apr 6, 2026
6f2f50e
cleanup and add citation links
annh3 Apr 6, 2026
a126b8f
add klein nb
annh3 Apr 7, 2026
2e7b77b
add flux one step velocity file
annh3 Apr 7, 2026
cc4ced7
Create README.md
annh3 Apr 7, 2026
b3ea00d
Update README.md
annh3 Apr 7, 2026
e3122b6
Update installation commands in README.md
annh3 Apr 7, 2026
c107e1f
add text embedder and load flow model wrapper.
annh3 Apr 7, 2026
f109d13
Merge branch 'main' of https://github.com/annh3/glass_flows_tutorial
annh3 Apr 7, 2026
d5e0e97
add disable grad and cpu offload seqeuntial to fix mps issues
annh3 Apr 8, 2026
3bbe9fa
cfg again
annh3 Apr 8, 2026
20d9e1a
image latent shape should be (batch, seq_len=h_latent*w_latent, chann…
annh3 Apr 9, 2026
f14e1a5
remove cc written code
annh3 Apr 10, 2026
2df8044
sampling
annh3 Apr 10, 2026
1356cea
sampling flux is working from visual inspection though some nondeterm…
annh3 Apr 11, 2026
efca9eb
save state for cc refactor
annh3 Apr 13, 2026
49ef6ca
noise
annh3 Apr 13, 2026
c23c59b
debugging time from 0 to 1 or 1 to 0 conventions
annh3 Apr 13, 2026
06857b3
fixed call to flux model flux_time = 1 - glass_time and negate direct…
annh3 Apr 14, 2026
f99ff57
Fix installation commands in README
annh3 Apr 14, 2026
bd05fec
add fks notebook
annh3 Apr 16, 2026
32ae605
Update README.md
annh3 Apr 16, 2026
1eb3fc4
Update installation instructions and remove imports
annh3 Apr 16, 2026
a13a5d2
Fix installation command formatting in README
annh3 Apr 16, 2026
d3a3d7b
Fix installation command formatting in README
annh3 Apr 16, 2026
1d14616
add reward model
annh3 Apr 16, 2026
79f8cf3
add glass_flows.py library file 2
annh3 Apr 16, 2026
ca1b116
add glass flows library file
annh3 Apr 16, 2026
6d494c7
add fks image example
annh3 Apr 16, 2026
2c92b61
add save image to glass_flows_klein_exp.ipynb and add fks steering wi…
annh3 Apr 16, 2026
9485ac9
fix cc written code to actually reweight particle weights for fks
annh3 Apr 16, 2026
611e810
add reward guidance and fks with reward guidance notebooks
annh3 Apr 16, 2026
1da1466
add context for reward guidance
annh3 Apr 17, 2026
a22d24b
add experiment notes
annh3 Apr 17, 2026
70fe93e
PIL conversion breaks teh tensor graph for autograd so importing imsc…
annh3 Apr 17, 2026
2b80ea9
strange results with reward guidance
annh3 Apr 17, 2026
c9bed1b
raw reward gradient and reward scoring of X_t instead of bar_X_s show…
annh3 Apr 20, 2026
bc98909
add gradient of bar_X_s reward guidance and also add constant weighti…
annh3 Apr 20, 2026
aea6991
add fks with reward guidance
annh3 Apr 20, 2026
f1d0f58
remove velocity epsilon conversion notebook
annh3 Apr 20, 2026
8e9645c
checkout upstream/main glass_flows_tutorial.ipynb
annh3 Apr 20, 2026
d417a83
add unit tests
annh3 Apr 20, 2026
f4ba0ac
clean up
annh3 Apr 20, 2026
46f1df5
Add GLASS Flows tutorial and requirements to README
annh3 Apr 20, 2026
65dcbb3
clean up
annh3 Apr 21, 2026
40ffc54
Merge branch 'cleaned_branch' of https://github.com/annh3/glass_flows…
annh3 Apr 21, 2026
049ea7d
Update README.md
annh3 Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 332 additions & 0 deletions .ipynb_checkpoints/fks_and_reward_guidance_klein-checkpoint.ipynb

Large diffs are not rendered by default.

528 changes: 528 additions & 0 deletions .ipynb_checkpoints/fks_steering_glass_flows_klein-checkpoint.ipynb

Large diffs are not rendered by default.

1,071 changes: 1,071 additions & 0 deletions .ipynb_checkpoints/glass_flows_klein_exp-checkpoint.ipynb

Large diffs are not rendered by default.

590 changes: 10 additions & 580 deletions .ipynb_checkpoints/glass_flows_tutorial-checkpoint.ipynb

Large diffs are not rendered by default.

1,913 changes: 1,913 additions & 0 deletions .ipynb_checkpoints/reward_guidance_klein-checkpoint.ipynb

Large diffs are not rendered by default.

625 changes: 625 additions & 0 deletions .ipynb_checkpoints/velocity_epsilon_conversion-checkpoint.ipynb

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#### GLASS Flows Tutorial

GLASS Flows are an inference-timer wrapper around pre-trained flow models converting sampling from an "ODE" paradigm to an "SDE"-like paradigm in which particle paths are refreshed by "inner" glass flows. Paper: https://arxiv.org/pdf/2509.25170.

##### Experiments

The notebooks build on each other in this order:

glass_flows_tutorial.ipynb — Start here. Introduces the GlassFlow class on a synthetic 2D checkerboard dataset with a from-scratch flow model. Covers the theory (Algorithm 1), stochastic transitions, and comparison to SDEs.

glass_flows_klein_exp.ipynb — First real-image experiment. Applies Glass Flows to the Flux.2-klein-base-4B model; establishes the image sampling setup used by all subsequent notebooks.

reward_guidance_klein.ipynb — Adds reward guidance: differentiable HPSv2 reward gradients are injected into the Glass Flow velocity at each inner step. Introduces GlassFlowBar_X_s (gradient on bar_X_s) and GlassFlowBar_X_sWeighted (gradient reweighted by σ²/α).

fks_steering_glass_flows_klein.ipynb — Feynman-Kac Steering (SMC): particles evolve through Glass Flow transitions, resampled at each backbone step by HPSv2 score. Proposal is the plain GlassFlow with no reward gradient.

fks_and_reward_guidance_klein.ipynb — Combines both: FKS loop using GlassFlowBar_X_sWeighted as the proposal, so reward guidance shapes each transition and SMC selection pressure is applied at each backbone step.


##### Environment Requirements
Listing the base model and reward models here.

pip install git+https://github.com/black-forest-labs/flux2.git \
pip install hpsv2 \
pip install imscore

##### Device

Note: This code is written for Apple Silicon (MPS). To run on CUDA, replace device="mps" with device="cuda" throughout, and update.
332 changes: 332 additions & 0 deletions fks_and_reward_guidance_klein.ipynb

Large diffs are not rendered by default.

Binary file added fks_image_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
528 changes: 528 additions & 0 deletions fks_steering_glass_flows_klein.ipynb

Large diffs are not rendered by default.

Loading