nickfraser commited on
Commit
bdf45c3
1 Parent(s): 34b0078

Feat (script): Added initial reproduction README.

Browse files
Files changed (1) hide show
  1. quant_sdxl/README.md +33 -0
quant_sdxl/README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Quantizing SDXL for MLPerf
2
+
3
+ The purpose of this document is to allow other users to quantize SDXL in various different ways, corresponding to AMD's 2024-07 MLPerf submission.
4
+
5
+ ## Environmental Setup
6
+
7
+ The environment can be set up as follows:
8
+
9
+ ```bash
10
+ conda env create -n quant_sdxl -f env/brv_sdxl_mlperf_minimal.yml # Use env/brv_sdxl_mlperf_rocm_minimal.yml is using a ROCm compatible GPU
11
+ conda activate quant_sdxl
12
+ ```
13
+
14
+ ## Fetching and Pre-Processing Datasets
15
+
16
+ Information on fetching and pre-processing the data can be found [here](https://github.com/mlcommons/inference/tree/master/text_to_image).
17
+ Note, the latents generated here will be used in the next step.
18
+
19
+ ## Quantize Int8 / FP16 Model
20
+
21
+ ```bash
22
+ python quant_sdxl.py --model stabilityai/stable-diffusion-xl-base-1.0 --device <device> --calibration-prompt-path ./captions.tsv --checkpoint-name unet.ckpt --path-to-latents <path/to/latents/latents.pt> --guidance-scale 7.5 --exclude-blacklist-act-eq [--path-to-coco <path/to/coco> --validation-prompts 5000]
23
+ ```
24
+
25
+ Note, you can optionally validate on the MLPerf validation set, but be aware this will take ~48hrs.
26
+
27
+ ## Quantize Int8 / FP8 Model
28
+
29
+ The Int8 / FP8 model can be quantized as follows:
30
+
31
+ ```bash
32
+ python quant_sdxl.py --model stabilityai/stable-diffusion-xl-base-1.0 --device <device> --calibration-prompt-path ./captions.tsv --checkpoint-name unet.ckpt --path-to-latents <path/to/latents/latents.pt> --guidance-scale 7.5 --quantize-sdp --exclude-blacklist-act-eq [--path-to-coco <path/to/coco> --validation-prompts 5000]
33
+ ```