pranamanam commited on
Commit
da65907
·
verified ·
1 Parent(s): 1cefa20

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -207
README.md DELETED
@@ -1,207 +0,0 @@
1
- ---
2
- license: mit
3
- language:
4
- - en
5
- tags:
6
- - education
7
- - pytorch
8
- - flow-matching
9
- - diffusion
10
- - esm2
11
- - protein-generation
12
- - guidance
13
- - mnist
14
- - image-generation
15
- ---
16
-
17
- # CIS 6270 Course Code
18
-
19
-
20
- ![CIS6270_Unified_Generative_Dynamics (1)](https://cdn-uploads.huggingface.co/production/uploads/64cd5b3f0494187a9e8b7c69/myMO3iMdYkquG6D5mhU4S.png)
21
-
22
- This repository contains code examples for CIS 6270, organized by lecture.
23
- We will develop the implementations alongside the course material, which connect
24
- the mathematical definitions, training objectives, and sampling equations to
25
- the executable PyTorch code herein. Each lecture directory contains its examples, data,
26
- and implementation notes.
27
-
28
- ## Lecture index
29
-
30
- | Lecture | Topics | Code and documentation |
31
- | --- | --- | --- |
32
- | 2 | Unconditional MNIST image generation with flow matching and a simple U-Net | [Guide](lecture_2/README.md) · [Script](lecture_2/flow_matching_unet_lecture.py) · [Saved checkpoint](https://huggingface.co/ChatterjeeLab/CIS6270/resolve/main/lecture_2/flow_unet_mnist.pt?download=true) |
33
- | 3 | Flow matching, diffusion, and guidance for ESM-2 residue embeddings | [Guide](lecture_3/README.md) · [Flow matching](lecture_3/esm2_flow_guidance.py) · [Diffusion](lecture_3/esm2_diffusion_guidance.py) |
34
- | 4 | Discrete diffusion, masked and uniform corruption, block generation, and guidance | [Guide](lecture_4/README.md) · [Training and generation](lecture_4/run.py) · [Slide code map](lecture_4/SLIDE_CODE_MAP.md) |
35
- | 5 | Discrete flow matching, Dirichlet and Fisher paths, Gumbel-Softmax, rectification, and multi-objective generation | [Guide](lecture_5/README.md) · [Training and generation](lecture_5/run.py) · [Slide code map](lecture_5/SLIDE_CODE_MAP.md) |
36
- | 6 | Continuous, latent, categorical, posterior, expanding, and strong stochastic flow maps | [Guide](lecture_6/README.md) · [Training and generation](lecture_6/run.py) · [Slide code map](lecture_6/SLIDE_CODE_MAP.md) |
37
- | 7 | Optimal transport, Sinkhorn, continuous and discrete Schrödinger bridges, matching, reward tilting, branching, and interacting control | [Guide](lecture_7/README.md) · [Training and generation](lecture_7/run.py) · [Slide code map](lecture_7/SLIDE_CODE_MAP.md) |
38
-
39
- ## Installation
40
-
41
- Use Python 3.11, or another compatible Python version at least 3.10, in a new
42
- virtual environment. The shared `requirements.txt` pins PyTorch 2.9.1,
43
- TorchVision 0.24.1, and Transformers 4.57.6. Lecture 2 uses PyTorch and
44
- TorchVision; Lecture 3 also uses Transformers. Lectures 4 and 5 use PyTorch,
45
- NumPy, and SciPy. Lecture 6 uses PyTorch and NumPy. Lecture 7 uses PyTorch, NumPy, and SciPy. These lecture folders also provide minimal requirements.
46
-
47
- ```bash
48
- git clone https://huggingface.co/ChatterjeeLab/CIS6270
49
- cd CIS6270
50
- git lfs pull
51
-
52
- python3 -m venv .venv
53
- source .venv/bin/activate
54
- python -m pip install --upgrade pip
55
- python -m pip install -r requirements.txt
56
- ```
57
-
58
- On Windows PowerShell, create the environment with `python -m venv .venv`
59
- and activate it with `.venv\Scripts\Activate.ps1`.
60
-
61
- The saved checkpoint uses Git LFS. If Git LFS is unavailable, download
62
- [flow_unet_mnist.pt](https://huggingface.co/ChatterjeeLab/CIS6270/resolve/main/lecture_2/flow_unet_mnist.pt?download=true)
63
- directly and place it in `lecture_2/`. Training from scratch does not require
64
- the saved checkpoint.
65
-
66
- ## Lecture 2: MNIST flow matching
67
-
68
- Lecture 2 contains one self-contained, commented script. It downloads MNIST,
69
- loads batches of normalized images, defines a small U-Net velocity network,
70
- trains it with conditional flow matching, and generates images from Gaussian
71
- noise using Euler integration.
72
-
73
- From the repository root:
74
-
75
- ```bash
76
- python lecture_2/flow_matching_unet_lecture.py
77
- ```
78
-
79
- The default run trains for 20 epochs and writes `samples.png`, `trajectory.png`,
80
- and a new `flow_unet_mnist.pt` to `flow_matching_outputs/`. The script selects
81
- CUDA, Apple MPS, or CPU according to availability. Its numbered `# %%` sections
82
- match the lecture walkthrough.
83
-
84
- The bundled [checkpoint](lecture_2/flow_unet_mnist.pt) has **5 completed epochs**
85
- on all 60,000 MNIST training images. The [Lecture 2 guide](lecture_2/README.md)
86
- includes a short example for loading it and generating images without training,
87
- along with selected generated digits and their noise-to-image trajectories.
88
-
89
- ## Lecture 3: Flow and diffusion guidance
90
-
91
- From the repository root:
92
-
93
- ```bash
94
- python lecture_3/esm2_flow_guidance.py --epochs 200 --samples 8
95
- python lecture_3/esm2_diffusion_guidance.py --epochs 200 --samples 8
96
- ```
97
-
98
- Both scripts train on ESM-2 residue embeddings and compare classifier-free
99
- guidance, single-objective reward steering, and scalarized multi-objective
100
- steering. We use the same property definitions, normalization, and final
101
- constrained decoder to compare the flow and diffusion implementations.
102
-
103
- The first run downloads the public ESM-2 checkpoint. Each script then writes
104
- generated sequences and model parameters to its own output directory.
105
- The [lecture guide](lecture_3/README.md) describes the data format, training
106
- and sampling settings, property calculations, normalization, and residue-count
107
- constraint, with commands for using a custom dataset.
108
-
109
- ## Lecture 4 - Discrete diffusion
110
-
111
- Train small DNA denoisers and generate sequences with MDLM, UDLM, block diffusion,
112
- classifier-free guidance, exact and gradient-based classifier guidance, and a
113
- PepTune-style search. The [guide](lecture_4/README.md) includes each method's
114
- command and mathematical assumptions. The [code map](lecture_4/SLIDE_CODE_MAP.md)
115
- links the slide walkthroughs to their functions.
116
-
117
- From the repository root, run the complete MDLM example.
118
-
119
- ```bash
120
- python lecture_4/run.py --method mdlm --data lecture_4/data/dna_train.tsv --out lecture_4/outputs/mdlm
121
- python lecture_4/run.py --method mdlm --mode sample --out lecture_4/outputs/mdlm
122
- ```
123
-
124
- The script trains, saves a checkpoint, and writes generated DNA and loss logs.
125
- The bundled data are synthetic, and the guidance objectives are explicit toy
126
- properties. No pretrained model or external dataset is required.
127
-
128
- ## Lecture 5 - Discrete flow matching
129
-
130
- Start with Gat et al.'s discrete flow matching, then run Dirichlet, Fisher,
131
- Gumbel-Softmax, rectified flow, ReDi, MOG-DFM, and AReUReDi examples. Each method
132
- has a complete training and generation command in the [guide](lecture_5/README.md).
133
-
134
- ```bash
135
- python lecture_5/run.py --method gat --data lecture_5/data/dna_train.tsv --out lecture_5/outputs/gat
136
- python lecture_5/run.py --method gat --mode sample --out lecture_5/outputs/gat
137
- ```
138
-
139
- Both folders include numerical examples, mathematical tests, and saved results
140
- from seeded CPU runs. The guides explain finite endpoint approximations and
141
- classroom simplifications for each method.
142
-
143
- ## Lecture 6 - Flow Maps
144
-
145
- Learn finite-time motion after the local flows from Lecture 5. The new folder
146
- contains 16 complete examples covering flow-map matching and self-distillation,
147
- consistency, Shortcut, MeanFlow, learned latent representations, Flow Map
148
- Language Models, Categorical and Discrete Flow Maps, Diamond Maps, Meta Flow
149
- Maps, Expanding Flow Maps, and Strong Stochastic Flow Maps.
150
-
151
- ```bash
152
- python lecture_6/run.py --method self-distill --out lecture_6/outputs/self-distill
153
- python lecture_6/run.py --mode sample --out lecture_6/outputs/self-distill --sample-steps 1
154
- python lecture_6/run_all.py --quick
155
- ```
156
-
157
- The [Lecture 6 guide](lecture_6/README.md) includes all method commands,
158
- training objectives, data formats, and numerical assumptions. The
159
- [slide code map](lecture_6/SLIDE_CODE_MAP.md) links implementations to the
160
- [Flow Maps presentation](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit).
161
- [Source notes](lecture_6/SOURCES.md) identify the exact papers and inspected
162
- author-code revisions, including differences between paper pseudocode and
163
- released implementations. [Verified examples](lecture_6/verified_examples/README.md)
164
- contain actual training logs, generated samples, and checkpoint-reload checks.
165
-
166
- ## Lecture 7 - Optimal Transport and Schrödinger Bridges
167
-
168
- The final lecture includes 17 complete numerical and learned examples: OT,
169
- Sinkhorn, finite and continuous-time bridges, DSB, DSBM, SF2M, DDSBM, CSBM,
170
- TR2-D2, BranchSBM, and EntangledSBM. Each runner saves its solved distribution
171
- or learned parameters and can reload them to generate samples.
172
-
173
- ```bash
174
- python lecture_7/run.py --method sf2m --out lecture_7/outputs/sf2m
175
- python lecture_7/run.py --mode sample --out lecture_7/outputs/sf2m
176
- python lecture_7/run_all.py --quick
177
- ```
178
-
179
- The [guide](lecture_7/README.md), [mathematical notes](lecture_7/MATHEMATICS.md),
180
- [slide code map](lecture_7/SLIDE_CODE_MAP.md), and [verified examples](lecture_7/verified_examples/README.md)
181
- follow the earlier lecture structure. The synthetic demonstrations distinguish
182
- exact calculations, finite discretizations, and learned approximations.
183
- Lectures [6](lecture_6/EQUATION_READINGS.md) and [7](lecture_7/EQUATION_READINGS.md)
184
- also include spoken readings of their equations before the intuition.
185
-
186
- ## Repository organization
187
-
188
- | Location | Contents |
189
- | --- | --- |
190
- | Repository root | Course index, installation requirements, and license |
191
- | [`lecture_2/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_2) | One MNIST flow-matching script, guide, trained checkpoint, and selected example images |
192
- | [`lecture_3/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_3) | ESM-2 flow and diffusion guidance scripts, sequence data, guide, and mathematical notes |
193
- | [`lecture_4/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_4) | Seven discrete diffusion and guidance examples, synthetic DNA, slide code map, and verified outputs |
194
- | [`lecture_5/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_5) | Eight discrete and simplex flow examples, synthetic DNA, slide code map, and verified outputs |
195
- | [`lecture_6/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_6) | Sixteen flow-map implementations, text data, mathematical notes, slide links, and verified outputs |
196
- | [`lecture_7/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_7) | Seventeen OT and bridge examples, derivations, equation readings, slide links, tests, and verified outputs |
197
-
198
- Installation instructions and the lecture index are maintained at the
199
- repository root. Lecture-specific commands, mathematical explanations, and
200
- references accompany the corresponding code.
201
-
202
- ## License
203
-
204
- The repository code is distributed under the
205
- [MIT License](https://huggingface.co/ChatterjeeLab/CIS6270/blob/main/LICENSE).
206
- ESM-2 weights are downloaded from their original repository under the
207
- corresponding distribution terms.