Skip to content

Commit 2bc287a

Browse files
authored
Update CFG section with additional details
These settings (γ = 7 and the unconditional prompt being '') will be used in all future usage of the CFG iterative denoise function.
1 parent 5e086e2 commit 2bc287a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

project-5/index.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,7 @@ <h2>Part 1.5 – Diffusion Model Sampling</h2>
422422
<section id="part-1-6">
423423
<h2>Part 1.6 – Classifier-Free Guidance (CFG)</h2>
424424

425-
To improve the quality of the images, we can compute both a noise estimate conditioned on the text prompt and the unconditional noise estimate based on the null prompt <code>''</code>. Denoting the conditional noise estimate as &epsilon;<sub>c</sub> and the unconditional noise estimate as &epsilon;<sub>u</sub>, we let our noise estimate be &epsilon; = &epsilon;<sub>u</sub> + &gamma;(&epsilon;<sub>c</sub> - &epsilon;<sub>u</sub>). Note that we have &epsilon; = &epsilon;<sub>u</sub> and &epsilon; = &epsilon;<sub>c</sub> for &gamma; = 0 and &gamma; = 1 respectively. However, when &gamma; > 1, we can get much higher equality images for reasons still discussed today. This technique is known as <strong>classifier-free guidance</strong>, and we can calculate the noise estimate as follows:
426-
427-
<pre><code>noise_est_cfg = uncond_noise_est + scale * (noise_est - uncond_noise_est)
428-
</code></pre>
429-
430-
By setting <code>scale = 7</code> (&gamma; = 7) and the conditional & unconditional prompts be <code>'a high quality photo'</code> & the null prompt <code>''</code>, we get the following sample images:
425+
To improve the quality of the images, we can compute both a noise estimate conditioned on the text prompt and the unconditional noise estimate based on the null prompt <code>''</code>. Denoting the conditional noise estimate as &epsilon;<sub>c</sub> and the unconditional noise estimate as &epsilon;<sub>u</sub>, we let our noise estimate be &epsilon; = &epsilon;<sub>u</sub> + &gamma;(&epsilon;<sub>c</sub> - &epsilon;<sub>u</sub>). Note that we have &epsilon; = &epsilon;<sub>u</sub> and &epsilon; = &epsilon;<sub>c</sub> for &gamma; = 0 and &gamma; = 1 respectively. However, when &gamma; > 1, we can get much higher equality images for reasons still discussed today. This technique is known as <strong>classifier-free guidance</strong>. By using &gamma; = 7 and the conditional & unconditional prompts be <code>'a high quality photo'</code> & the null prompt <code>''</code>, we get the following sample images:
431426

432427
<div class="subsection">
433428
<div class="image-row">
@@ -453,6 +448,8 @@ <h2>Part 1.6 – Classifier-Free Guidance (CFG)</h2>
453448
</figure>
454449
</div>
455450
</div>
451+
452+
These settings (&gamma; = 7 and the uncondtional prompt being <code>''</code>) will be used in all future usage of the CFG iterative denoise function.
456453
</section>
457454

458455
<!-- ========================================================= -->

0 commit comments

Comments
 (0)