Skip to content

Commit 57310a8

Browse files
committed
udpate DeepCache/README.md
1 parent 0540d34 commit 57310a8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

DeepCache/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

2-
## Code
2+
# Code
33

4-
### TOC
4+
## TOC
55
- [Explanation of Code for SD/SDXL](#code-for-sd-and-sdxl)
66
- [Code for DDPM](#experiment-code-for-ddpm)
7+
- [MACs Calculation](#macs-calculation)
78

8-
### Explanation of Code for SD and SDXL
9+
## Explanation of Code for SD and SDXL
910

1011
We make some modifications to the code for SD and SDXL. Here we use the code of SD as an example to highlight the key changes:
1112

@@ -23,7 +24,7 @@ Adjusted the forward functions of `CrossAttnDownBlock2D` and `CrossAttnUpBlock2D
2324
4. `unet_2d_condition.py`:
2425
Altered the forward function (Lines 957-1142) to also reuse or cache features.
2526

26-
### Experiment Code for DDPM
27+
## Experiment Code for DDPM
2728

2829
#### Requirement
2930
```
@@ -44,10 +45,10 @@ python fid.py --path runtime_log/{YOUR_PATH_FOR_IMAGES}/images npz/cifar10_fid.n
4445
```
4546
The pre-calculated npz archive for these three datasets can be downloaded [here](https://drive.google.com/file/d/1oAb3Jik40mExmUhWcF990IRDY5UvT1rh/view?usp=sharing). The npz archives are generated following [the instruction](https://github.com/mseitzer/pytorch-fid?tab=readme-ov-file#generating-a-compatible-npz-archive-from-a-dataset) in `pytorch-fid`.
4647

47-
#### MACs Calculation
48+
## MACs Calculation
4849
If you want to calculate the FLOPs for each model, and also the FLOPs of the partial model executed in DeepCache, you can use the following code snippet, insert it before the iteration of denoising, and get the MACs of the model. Here are two examples:
4950

50-
* For DDPM: (insert it in [Line](https://github.com/horseee/DeepCache/blob/fb0ec94e046068eceebe185b2f5cada55b11be1e/DeepCache/ddpm/ddpm/runners/deepcache.py#L153))
51+
* For DDPM: (insert it in [Line 153](https://github.com/horseee/DeepCache/blob/fb0ec94e046068eceebe185b2f5cada55b11be1e/DeepCache/ddpm/ddpm/runners/deepcache.py#L153) for DDPM pipeline)
5152
```python
5253
import sys
5354
sys.path.append('../')

0 commit comments

Comments
 (0)