/diffusion_model_and_minGPT_analysis

An implementation of a basic diffusion model with some insights and testing the minGPT model

Primary LanguageJupyter Notebook

Diffusion and minGPT analysis:

Unconditional diffusion model:

this analysis uses 2D data for low computetional resource requirements, but the main ideas are the same for higher dimention data.

plot of the forward noise process of a random sample:

Screenshot 2023-07-18 at 11 27 42

Denoiser train loss:

Screenshot 2023-07-18 at 11 27 59

DDIM sampling for 9 different seeds:

Screenshot 2023-07-18 at 11 28 15

Effect of the number of denoising steps on the generated point (on a single point and for large nunber of points):

Screenshot 2023-07-18 at 11 28 31

trials with a different sampler:

Screenshot 2023-07-18 at 11 28 46

no noticable differance

adding noise to the sampling process:

Screenshot 2023-07-18 at 11 29 04

another view:

Screenshot 2023-07-18 at 11 29 16


conditional diffusion model:

training

Generated train data: Screenshot 2023-07-18 at 11 29 29

Train loss:

Screenshot 2023-07-18 at 11 35 08

sampling one point from each class:

Screenshot 2023-07-18 at 11 30 08

sampling 1000 random samples from the model:

Screenshot 2023-07-18 at 11 30 17

point estimation for 5 representaive samples:

check for class variation, OOD to variable degrees and probable samples Screenshot 2023-07-18 at 11 31 11


minGPT

to make the minGPT part work - clone the mingpt repo and replace the model.py file from there.

train loss:

Screenshot 2023-07-18 at 11 35 33

latents optimization (LO) for making the model output a never seen before sentance:

the wanted sentance is "I am a little squirrel holding a walnut" Screenshot 2023-07-18 at 11 31 52

Attention analasys for the last transformer block:

Screenshot 2023-07-18 at 11 36 03

Attention analasys for the first transformer block:

Screenshot 2023-07-18 at 11 36 13

Attention visualization:

Screenshot 2023-07-18 at 11 36 27

probability of an example generated output:

Screenshot 2023-07-18 at 11 36 49