# How Diffusion Models Work

**URL:** https://community.deeplearning.ai/c/short-course-q-a/how-diffusion-models-work/333.md?page=1

[Latest](https://community.deeplearning.ai/latest.md) · [Categories](https://community.deeplearning.ai/categories.md) · [Tags](https://community.deeplearning.ai/tags.md)

**Page:** 2

---

## [How to create the weights from new sprites?](https://community.deeplearning.ai/t/how-to-create-the-weights-from-new-sprites/444760)

<div class="topic-metadata">

**Author:** [@sanimesa](https://community.deeplearning.ai/u/sanimesa)\
**Replies:** 0\
**Last updated:** [September 13, 2023, 9:47pm UTC](https://community.deeplearning.ai/t/how-to-create-the-weights-from-new-sprites/444760 "2023-09-13T21:47:14Z")

</div>

Can I use my own input sprites? How do I create the weights? Also, in the example with no context, does the model simply reproduce the input sprites? Thanks.

---

## [Wrong Implementation of perturb\_input](https://community.deeplearning.ai/t/wrong-implementation-of-perturb-input/420302)

<div class="topic-metadata">

**Author:** [@Yacine\_Mazari](https://community.deeplearning.ai/u/Yacine_Mazari)\
**Replies:** 0\
**Last updated:** [August 17, 2023, 12:51pm UTC](https://community.deeplearning.ai/t/wrong-implementation-of-perturb-input/420302 "2023-08-17T12:51:47Z")

</div>

Hi I think there is an error in the notebook in the implementation of perturb\_input, the weight for the noise should be square-rooted. Current: def perturb\_input(x, t, noise): return ab\_t.sqrt()\[t, None, None, None\] …

---

## [How diffusion models work - L1 Sampling](https://community.deeplearning.ai/t/how-diffusion-models-work-l1-sampling/364576)

<div class="topic-metadata">

**Author:** [@marcseb](https://community.deeplearning.ai/u/marcseb)\
**Replies:** 5\
**Last updated:** [August 15, 2023, 6:54am UTC](https://community.deeplearning.ai/t/how-diffusion-models-work-l1-sampling/364576 "2023-08-15T06:54:25Z")

</div>

Hi, I am trying to run locally the first lab “L1 Sampling” of the new short course “How diffusion models work”, but I can’t install the package diffusion-utilities. I tried pip and apt-get without success. Thank you in …

---

## [DDIM incorrect](https://community.deeplearning.ai/t/ddim-incorrect/409931)

<div class="topic-metadata">

**Author:** [@Schmidhuber](https://community.deeplearning.ai/u/Schmidhuber)\
**Replies:** 0\
**Last updated:** [August 6, 2023, 4:06pm UTC](https://community.deeplearning.ai/t/ddim-incorrect/409931 "2023-08-06T16:06:50Z")

</div>

The denoising seems to be incorrect. The last generated set of images is more noisy than the second-to-last and third-to-last images. For reference, see this image where each row corresponds to a sampling step of DDIM. …

---

## [Sprites\_1788\_16x16.npy is repeated 50 times](https://community.deeplearning.ai/t/sprites-1788-16x16-npy-is-repeated-50-times/409797)

<div class="topic-metadata">

**Author:** [@Schmidhuber](https://community.deeplearning.ai/u/Schmidhuber)\
**Replies:** 0\
**Last updated:** [August 6, 2023, 1:44pm UTC](https://community.deeplearning.ai/t/sprites-1788-16x16-npy-is-repeated-50-times/409797 "2023-08-06T13:44:29Z")

</div>

The file sprites\_1788\_16x16.npy contains a NumPy array of the shape (89400, 16, 16, 3), which might suggest that it contains 89400 distinct sprites. However, that is not the case. The file contains the same 1788 sprites …

---

## [Where Can I find this course?](https://community.deeplearning.ai/t/where-can-i-find-this-course/404529)

<div class="topic-metadata">

**Author:** [@kawshik\_selvaraj1](https://community.deeplearning.ai/u/kawshik_selvaraj1)\
**Replies:** 2\
**Last updated:** [August 1, 2023, 1:31pm UTC](https://community.deeplearning.ai/t/where-can-i-find-this-course/404529 "2023-08-01T13:31:05Z")

</div>

Hi, Can someone tell me where can I find the short courses ? Are they in coursera ??

---

## [What are the adjustment to be done for training larger image?](https://community.deeplearning.ai/t/what-are-the-adjustment-to-be-done-for-training-larger-image/388062)

<div class="topic-metadata">

**Author:** [@gokul\_gj2](https://community.deeplearning.ai/u/gokul_gj2)\
**Replies:** 0\
**Last updated:** [July 17, 2023, 4:45pm UTC](https://community.deeplearning.ai/t/what-are-the-adjustment-to-be-done-for-training-larger-image/388062 "2023-07-17T16:45:23Z")

</div>

Existing code only allows images of sizes up to 28x28 which is divisible by 4. I am trying to train the model with images size 150x150. Tried different adjustments in ContextUnet class but was unsuccessful. Please help

---

## [L2,Training, Where can I find "model\_n.pth"?](https://community.deeplearning.ai/t/l2-training-where-can-i-find-model-n-pth/386207)

<div class="topic-metadata">

**Author:** [@ElhamS](https://community.deeplearning.ai/u/ElhamS)\
**Replies:** 0\
**Last updated:** [July 15, 2023, 6:36pm UTC](https://community.deeplearning.ai/t/l2-training-where-can-i-find-model-n-pth/386207 "2023-07-15T18:36:38Z")

</div>

Where can I find “model\_0.pth”, “model\_4.pth”, … to view different epochs?

---

## [Unreliability of GIF Animating HTML in](https://community.deeplearning.ai/t/unreliability-of-gif-animating-html-in/379199)

<div class="topic-metadata">

**Author:** [@rdthompson](https://community.deeplearning.ai/u/rdthompson)\
**Replies:** 1\
**Last updated:** [July 10, 2023, 9:37am UTC](https://community.deeplearning.ai/t/unreliability-of-gif-animating-html-in/379199 "2023-07-10T09:37:11Z")

</div>

There is an unreliability (sometimes works and sometimes doesn’t with no changes), of the “gif animating” in Visualize Samples in Neural Network (L1\_Sample, Cells 9 and 11) and Speeding Up (Lab 4, Fast Sampling, Cell 9 a…

---

## [Do embedding vectors introduce randomness in output image?](https://community.deeplearning.ai/t/do-embedding-vectors-introduce-randomness-in-output-image/371033)

<div class="topic-metadata">

**Author:** [@cdahllof](https://community.deeplearning.ai/u/cdahllof)\
**Replies:** 0\
**Last updated:** [July 2, 2023, 3:22pm UTC](https://community.deeplearning.ai/t/do-embedding-vectors-introduce-randomness-in-output-image/371033 "2023-07-02T15:22:13Z")

</div>

Hi Everyone, I understand that the model uses noise and that different noise will create different outputs. In Mid Journey I can set the seed and I get the same image with the same prompt. If I set the seed and vary th…

---

## [How nowadays real, big models work?](https://community.deeplearning.ai/t/how-nowadays-real-big-models-work/367154)

<div class="topic-metadata">

**Author:** [@pierre\_bedu](https://community.deeplearning.ai/u/pierre_bedu)\
**Replies:** 0\
**Last updated:** [June 29, 2023, 2:47pm UTC](https://community.deeplearning.ai/t/how-nowadays-real-big-models-work/367154 "2023-06-29T14:47:36Z")

</div>

Super great course! Thanks a lot. I 'm trying to build a modern diffusion model and i have some questions : 1/ what problem do bigger images (500\*500) can cause? (slower training of course and ?) 2/ what network is u…

---

## [Interesting finding](https://community.deeplearning.ai/t/interesting-finding/365102)

<div class="topic-metadata">

**Author:** [@akshath1](https://community.deeplearning.ai/u/akshath1)\
**Replies:** 0\
**Last updated:** [June 28, 2023, 9:08am UTC](https://community.deeplearning.ai/t/interesting-finding/365102 "2023-06-28T09:08:28Z")

</div>

When the instructor told us about why noise should be added between timesteps I thought instead of adding noise to keep it in a normal distribution, why cant you just map each value or (round) each value to their respect…

---

## [Nn\_model.train() not working](https://community.deeplearning.ai/t/nn-model-train-not-working/363176)

<div class="topic-metadata">

**Author:** [@borch](https://community.deeplearning.ai/u/borch)\
**Replies:** 0\
**Last updated:** [June 25, 2023, 4:47pm UTC](https://community.deeplearning.ai/t/nn-model-train-not-working/363176 "2023-06-25T16:47:08Z")

</div>

Hello I am running locally the training notebook, however when I get to the step nn\_model.train() it seems the model is not being trained and it immediately shows the following output: ContextUnet( (init\_conv): Resid…

---

## [\# down1 #\[10, 256, 8, 8\] self.down2 = UnetDown(n\_feat, 2 \* n\_feat) # down2 #\[10, 256, 4, 4\] # original: self.to\_vec = nn.Sequential(nn.AvgPool2d(7), nn.GELU())](https://community.deeplearning.ai/t/down1-10-256-8-8-self-down2-unetdown-n-feat-2-n-feat-down2-10-256-4-4-original-self-to-vec-nn-sequential-nn-avgpool2d-7-nn-gelu/361772)

<div class="topic-metadata">

**Author:** [@krupan](https://community.deeplearning.ai/u/krupan)\
**Replies:** 0\
**Last updated:** [June 23, 2023, 8:52am UTC](https://community.deeplearning.ai/t/down1-10-256-8-8-self-down2-unetdown-n-feat-2-n-feat-down2-10-256-4-4-original-self-to-vec-nn-sequential-nn-avgpool2d-7-nn-gelu/361772 "2023-06-23T08:52:22Z")

</div>

i am getting indentation error token 44 , please help in Sampling video

---

## [Context code, dataloader is not defined](https://community.deeplearning.ai/t/context-code-dataloader-is-not-defined/353647)

<div class="topic-metadata">

**Author:** [@vsrinivas](https://community.deeplearning.ai/u/vsrinivas)\
**Replies:** 1\
**Last updated:** [June 20, 2023, 3:35pm UTC](https://community.deeplearning.ai/t/context-code-dataloader-is-not-defined/353647 "2023-06-20T15:35:11Z")

</div>

In the context (Controlling) chapter, kindly note that dataloader (pbar = tqdm(dataloader, mininterval=2 ) is not predefined, hence that will result in error, if we try to train the model. Can this be checked?

---

## [Detecting plagiarism in ChatGPT output](https://community.deeplearning.ai/t/detecting-plagiarism-in-chatgpt-output/358611)

<div class="topic-metadata">

**Author:** [@nasimakhtar](https://community.deeplearning.ai/u/nasimakhtar)\
**Replies:** 2\
**Last updated:** [June 19, 2023, 8:16am UTC](https://community.deeplearning.ai/t/detecting-plagiarism-in-chatgpt-output/358611 "2023-06-19T08:16:58Z")

</div>

Levenshtein distance is an excellent metric to measure the difference between two string data sets, but is Levenshtein a good measure to detect plagiarism between content produced by ChatGPT & a referred source? If not, …

---

## [Code for diffusion\_utilities used in "How Diffusion Models work"?](https://community.deeplearning.ai/t/code-for-diffusion-utilities-used-in-how-diffusion-models-work/358094)

<div class="topic-metadata">

**Author:** [@skymanaditya1](https://community.deeplearning.ai/u/skymanaditya1)\
**Replies:** 2\
**Last updated:** [June 18, 2023, 7:18am UTC](https://community.deeplearning.ai/t/code-for-diffusion-utilities-used-in-how-diffusion-models-work/358094 "2023-06-18T07:18:10Z")

</div>

Hi, I am trying to setup the code for running diffusion models in the Short Course “How Diffusion Models Work” on my own server. The provided notebooks have a line - ‘from diffusion\_utilities import \*’. However, I am una…

---

## [Reasons for adding extra noise to the training data](https://community.deeplearning.ai/t/reasons-for-adding-extra-noise-to-the-training-data/352432)

<div class="topic-metadata">

**Author:** [@LaurenceAnthony](https://community.deeplearning.ai/u/LaurenceAnthony)\
**Replies:** 3\
**Last updated:** [June 9, 2023, 3:21pm UTC](https://community.deeplearning.ai/t/reasons-for-adding-extra-noise-to-the-training-data/352432 "2023-06-09T15:21:38Z")

</div>

I thought the explanation for why additional noise is added during training was not very clear. So, I asked ChatGPT (3.5) to explain the reasons. This is what is said: PROMPT: Can you explain why adding extra noise to …

---

## [Question on noise prediction](https://community.deeplearning.ai/t/question-on-noise-prediction/348888)

<div class="topic-metadata">

**Author:** [@zyzhang1130](https://community.deeplearning.ai/u/zyzhang1130)\
**Replies:** 5\
**Last updated:** [June 9, 2023, 10:33am UTC](https://community.deeplearning.ai/t/question-on-noise-prediction/348888 "2023-06-09T10:33:51Z")

</div>

I don’t understand how a NN can be trained to predict noise, because noise is random and isn’t supposed to exhibit some learnable features. Can anyone help to explain? Thanks.

---

## [My how diffusion models work isnt working](https://community.deeplearning.ai/t/my-how-diffusion-models-work-isnt-working/350826)

<div class="topic-metadata">

**Author:** [@necx12](https://community.deeplearning.ai/u/necx12)\
**Replies:** 3\
**Last updated:** [June 6, 2023, 10:09pm UTC](https://community.deeplearning.ai/t/my-how-diffusion-models-work-isnt-working/350826 "2023-06-06T22:09:54Z")

</div>

my videos dont play after a while, what is wrong?

---

## [Certificate for this course](https://community.deeplearning.ai/t/certificate-for-this-course/350535)

<div class="topic-metadata">

**Author:** [@Hitarth\_Bhatt](https://community.deeplearning.ai/u/Hitarth_Bhatt)\
**Replies:** 2\
**Last updated:** [June 5, 2023, 6:18pm UTC](https://community.deeplearning.ai/t/certificate-for-this-course/350535 "2023-06-05T18:18:34Z")

</div>

Is there a plan to provide a certificate for this course? Would highly appreciate this.

---

## [Where do I get the sprites data?](https://community.deeplearning.ai/t/where-do-i-get-the-sprites-data/348444)

<div class="topic-metadata">

**Author:** [@pmanandhar](https://community.deeplearning.ai/u/pmanandhar)\
**Replies:** 3\
**Last updated:** [June 4, 2023, 6:36pm UTC](https://community.deeplearning.ai/t/where-do-i-get-the-sprites-data/348444 "2023-06-04T18:36:24Z")

</div>

I was able to get diffusion\_utilities, but now I am stuck on the data… sprites\_1788\_16x16.npy ? Where do I get, or how do I generate these files?

---

## [3 questions about the diagram of the Unet](https://community.deeplearning.ai/t/3-questions-about-the-diagram-of-the-unet/348242)

<div class="topic-metadata">

**Author:** [@samraul](https://community.deeplearning.ai/u/samraul)\
**Replies:** 1\
**Last updated:** [June 3, 2023, 9:04pm UTC](https://community.deeplearning.ai/t/3-questions-about-the-diagram-of-the-unet/348242 "2023-06-03T21:04:56Z")

</div>

Hi, I have 3 questions about the diagram: In the diagram, all layers except the last one are represented as ResidualConvBlocks, but in the code, only the first layer (Init.conv) actually sets is\_res to true. Should a…

---

## [CC for this course (Live WebVTT)](https://community.deeplearning.ai/t/cc-for-this-course-live-webvtt/348231)

<div class="topic-metadata">

**Author:** [@rdthompson](https://community.deeplearning.ai/u/rdthompson)\
**Replies:** 1\
**Last updated:** [June 3, 2023, 7:24am UTC](https://community.deeplearning.ai/t/cc-for-this-course-live-webvtt/348231 "2023-06-03T07:24:12Z")

</div>

I have 20%/0% speech understanding in left right ears (clinically deaf). I’ve always enjoyed Andrew Ng’s courses and very much appreciate when you can add captions \[CC\] WebVTT and secondarily Transcript. Live \[CC\] helps…

---

## [About the helper function in the diffusion model course](https://community.deeplearning.ai/t/about-the-helper-function-in-the-diffusion-model-course/348221)

<div class="topic-metadata">

**Author:** [@Bayu\_Gautama\_Wundari](https://community.deeplearning.ai/u/Bayu_Gautama_Wundari)\
**Replies:** 1\
**Last updated:** [June 3, 2023, 7:09am UTC](https://community.deeplearning.ai/t/about-the-helper-function-in-the-diffusion-model-course/348221 "2023-06-03T07:09:16Z")

</div>

Hi everyone, just wondering where can i find the helper function codes used in the diffusion model short course? i wanna try out the tutorial on my own laptop… thank you best, Bayu

[Previous page](https://community.deeplearning.ai/c/short-course-q-a/how-diffusion-models-work/333.md)
