Skip to content

Commit f161e27

Browse files
regissssayakpaulstevhliu
authored
Update Intel Gaudi doc (#11479)
Co-authored-by: Sayak Paul <[email protected]> Co-authored-by: Steven Liu <[email protected]>
1 parent a5f4cc7 commit f161e27

File tree

4 files changed

+15
-60
lines changed

4 files changed

+15
-60
lines changed

docs/source/en/_toctree.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
- local: optimization/mps
209209
title: Metal Performance Shaders (MPS)
210210
- local: optimization/habana
211-
title: Habana Gaudi
211+
title: Intel Gaudi
212212
- local: optimization/neuron
213213
title: AWS Neuron
214214
title: Optimized hardware

docs/source/en/optimization/habana.md

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,67 +10,22 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
1010
specific language governing permissions and limitations under the License.
1111
-->
1212

13-
# Habana Gaudi
13+
# Intel Gaudi
1414

15-
🤗 Diffusers is compatible with Habana Gaudi through 🤗 [Optimum](https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion). Follow the [installation](https://docs.habana.ai/en/latest/Installation_Guide/index.html) guide to install the SynapseAI and Gaudi drivers, and then install Optimum Habana:
15+
The Intel Gaudi AI accelerator family includes [Intel Gaudi 1](https://habana.ai/products/gaudi/), [Intel Gaudi 2](https://habana.ai/products/gaudi2/), and [Intel Gaudi 3](https://habana.ai/products/gaudi3/). Each server is equipped with 8 devices, known as Habana Processing Units (HPUs), providing 128GB of memory on Gaudi 3, 96GB on Gaudi 2, and 32GB on the first-gen Gaudi. For more details on the underlying hardware architecture, check out the [Gaudi Architecture](https://docs.habana.ai/en/latest/Gaudi_Overview/Gaudi_Architecture.html) overview.
1616

17-
```bash
18-
python -m pip install --upgrade-strategy eager optimum[habana]
19-
```
20-
21-
To generate images with Stable Diffusion 1 and 2 on Gaudi, you need to instantiate two instances:
22-
23-
- [`~optimum.habana.diffusers.GaudiStableDiffusionPipeline`], a pipeline for text-to-image generation.
24-
- [`~optimum.habana.diffusers.GaudiDDIMScheduler`], a Gaudi-optimized scheduler.
25-
26-
When you initialize the pipeline, you have to specify `use_habana=True` to deploy it on HPUs and to get the fastest possible generation, you should enable **HPU graphs** with `use_hpu_graphs=True`.
17+
Diffusers pipelines can take advantage of HPU acceleration, even if a pipeline hasn't been added to [Optimum for Intel Gaudi](https://huggingface.co/docs/optimum/main/en/habana/index) yet, with the [GPU Migration Toolkit](https://docs.habana.ai/en/latest/PyTorch/PyTorch_Model_Porting/GPU_Migration_Toolkit/GPU_Migration_Toolkit.html).
2718

28-
Finally, specify a [`~optimum.habana.GaudiConfig`] which can be downloaded from the [Habana](https://huggingface.co/Habana) organization on the Hub.
29-
30-
```python
31-
from optimum.habana import GaudiConfig
32-
from optimum.habana.diffusers import GaudiDDIMScheduler, GaudiStableDiffusionPipeline
33-
34-
model_name = "stabilityai/stable-diffusion-2-base"
35-
scheduler = GaudiDDIMScheduler.from_pretrained(model_name, subfolder="scheduler")
36-
pipeline = GaudiStableDiffusionPipeline.from_pretrained(
37-
model_name,
38-
scheduler=scheduler,
39-
use_habana=True,
40-
use_hpu_graphs=True,
41-
gaudi_config="Habana/stable-diffusion-2",
42-
)
43-
```
19+
Call `.to("hpu")` on your pipeline to move it to a HPU device as shown below for Flux:
20+
```py
21+
import torch
22+
from diffusers import DiffusionPipeline
4423

45-
Now you can call the pipeline to generate images by batches from one or several prompts:
24+
pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
25+
pipeline.to("hpu")
4626

47-
```python
48-
outputs = pipeline(
49-
prompt=[
50-
"High quality photo of an astronaut riding a horse in space",
51-
"Face of a yellow cat, high resolution, sitting on a park bench",
52-
],
53-
num_images_per_prompt=10,
54-
batch_size=4,
55-
)
27+
image = pipeline("An image of a squirrel in Picasso style").images[0]
5628
```
5729

58-
For more information, check out 🤗 Optimum Habana's [documentation](https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion) and the [example](https://github.com/huggingface/optimum-habana/tree/main/examples/stable-diffusion) provided in the official GitHub repository.
59-
60-
## Benchmark
61-
62-
We benchmarked Habana's first-generation Gaudi and Gaudi2 with the [Habana/stable-diffusion](https://huggingface.co/Habana/stable-diffusion) and [Habana/stable-diffusion-2](https://huggingface.co/Habana/stable-diffusion-2) Gaudi configurations (mixed precision bf16/fp32) to demonstrate their performance.
63-
64-
For [Stable Diffusion v1.5](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5) on 512x512 images:
65-
66-
| | Latency (batch size = 1) | Throughput |
67-
| ---------------------- |:------------------------:|:---------------------------:|
68-
| first-generation Gaudi | 3.80s | 0.308 images/s (batch size = 8) |
69-
| Gaudi2 | 1.33s | 1.081 images/s (batch size = 8) |
70-
71-
For [Stable Diffusion v2.1](https://huggingface.co/stabilityai/stable-diffusion-2-1) on 768x768 images:
72-
73-
| | Latency (batch size = 1) | Throughput |
74-
| ---------------------- |:------------------------:|:-------------------------------:|
75-
| first-generation Gaudi | 10.2s | 0.108 images/s (batch size = 4) |
76-
| Gaudi2 | 3.17s | 0.379 images/s (batch size = 8) |
30+
> [!TIP]
31+
> For Gaudi-optimized diffusion pipeline implementations, we recommend using [Optimum for Intel Gaudi](https://huggingface.co/docs/optimum/main/en/habana/index).

docs/source/ko/_toctree.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
- local: optimization/mps
176176
title: Metal Performance Shaders (MPS)
177177
- local: optimization/habana
178-
title: Habana Gaudi
178+
title: Intel Gaudi
179179
title: 최적화된 하드웨어
180180
title: 추론 가속화와 메모리 줄이기
181181
- sections:

docs/source/ko/optimization/habana.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
1010
specific language governing permissions and limitations under the License.
1111
-->
1212

13-
# Habana Gaudi에서 Stable Diffusion을 사용하는 방법
13+
# Intel Gaudi에서 Stable Diffusion을 사용하는 방법
1414

1515
🤗 Diffusers는 🤗 [Optimum Habana](https://huggingface.co/docs/optimum/habana/usage_guides/stable_diffusion)를 통해서 Habana Gaudi와 호환됩니다.
1616

0 commit comments

Comments
 (0)