You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/dreambooth/README_hidream.md
+27
Original file line number
Diff line number
Diff line change
@@ -117,3 +117,30 @@ We provide several options for optimizing memory optimization:
117
117
*`--use_8bit_adam`: When enabled, we will use the 8bit version of AdamW provided by the `bitsandbytes` library.
118
118
119
119
Refer to the [official documentation](https://huggingface.co/docs/diffusers/main/en/api/pipelines/) of the `HiDreamImagePipeline` to know more about the model.
120
+
121
+
## Using quantization
122
+
123
+
You can quantize the base model with [`bitsandbytes`](https://huggingface.co/docs/bitsandbytes/index) to reduce memory usage. To do so, pass a JSON file path to `--bnb_quantization_config_path`. This file should hold the configuration to initialize `BitsAndBytesConfig`. Below is an example JSON file:
124
+
125
+
```json
126
+
{
127
+
"load_in_4bit": true,
128
+
"bnb_4bit_quant_type": "nf4"
129
+
}
130
+
```
131
+
132
+
Below, we provide some numbers with and without the use of NF4 quantization when training:
The reason why we see some memory before device placement in the case of quantization is because, by default bnb quantized models are placed on the GPU first.
0 commit comments