Skip to content

Commit 90ccb0f

Browse files
authored
Update proj5.html
1 parent 337a66f commit 90ccb0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

project-5/proj5.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,14 +1059,14 @@ <h4>Time-Conditioned Forward and Sampling Operations</h4>
10591059
Although the results are not perfect, the improvements starting from the 1st epoch up to the 10th are already noticeable.
10601060

10611061
<h4>Adding Class-Conditioning to Time-Conditioned UNet</h4>
1062-
To make more improvements to our image generation, we can condition our UNet on the class of digits 0-9. This requires adding an additional FCBlock for each time condition, where the class vector <code>c</code> is a one-hot vector. To ensure that the UNet would still work without conditioning on the class (in order to implement CFG later), we will set a dropout rate <code>p<sub>uncond</sub></code> of 0.1, in which we set the one-hot vector of <code>c</code> to all 0s.
1062+
To make more improvements to our image generation, we can condition our UNet on the class of digits 0-9. This requires adding an additional FCBlock for the <code>unflat</code> and <code>firstUpBlock</code> tensor, where we convert the class vector <code>c</code> into a one-hot vector before passing it through FCBlock. To ensure that the UNet would still work without conditioning on the class (in order to implement CFG later), we will set a dropout rate <code>p<sub>uncond</sub></code> of 0.1, in which we set the one-hot vector of <code>c</code> to all 0s.
10631063

10641064
<h4>Embedding <code>c</code> and <code>t</code> in the UNet</h4>
10651065
To embed <code>c</code> <code>t</code> in the UNet, we will use 2 additional FCBlocks to convert the label (<code>c</code>) into 2 tensors <code>fc1_c</code> and <code>fc2_c</code>, each with the same number of hidden dimensions as <code>fc1_t</code> and <code>fc2_t</code> respectively. Then, instead of multiplying the intermediate blocks by the time tensor, we will instead do:
10661066
<pre><code>unflat_cond_class = unflat * fc1_c + fc1_t
1067-
firstUpBlock_cond = firstUpBlock * fc2_c + fc2_t</code></pre>
1067+
firstUpBlock_cond_class = firstUpBlock * fc2_c + fc2_t</code></pre>
10681068

1069-
The last step is to zero out the class one-hot vectors at the dropout rate, which we can implement efficiently by using a mask of the same length as the batch size. We can then multiply the batch of one-hot vectors with it to zero out any vector that is the <code>i</code>-th in the batch if <code>mask[i] = 0</code>.
1069+
The last step is to zero out the class one-hot vectors at the dropout rate, which we can implement efficiently by using a mask of the same length as the batch size. We can then multiply the batch of one-hot vectors by the mask to zero out any vector that is the <code>i</code>-th in the batch if <code>mask[i] = 0</code>.
10701070

10711071
<h4>Class Conditioning Hyperparameters</h4>
10721072
Because class conditioning converges fast, we will use the same number of training epochs as time conditioning, which is 10. A guidance scale of &gamma; = 5 will be used in the CFG part. The same hyperparameters as the Time-Conditioned UNet will be used for the relevant parts.

0 commit comments

Comments
 (0)