Stable Diffusion
Last updated
Last updated
Stable Diffusion is a text-to-image latent diffusion model. Check out this for more information.
To generate images with Stable Diffusion on Gaudi, you need to instantiate two instances:
A pipeline with . This pipeline supports text-to-image generation.
A scheduler with . This scheduler has been optimized for Gaudi.
When initializing the pipeline, you have to specify use_habana=True
to deploy it on HPUs. Furthermore, to get the fastest possible generations you should enable HPU graphs with use_hpu_graphs=True
. Finally, you will need to specify a which can be downloaded from the BOINC AI Hub.
Copied
You can then call the pipeline to generate images from one or several prompts:
Copied
Copied
There are two different checkpoints for Stable Diffusion 2:
To accelerate your Stable Diffusion pipeline, you can run it in full bfloat16 precision. This will also save memory. You just need to pass torch_dtype=torch.bfloat16
to from_pretrained
when instantiating your pipeline. Here is how to do it:
Copied
The Stable Diffusion upscaler diffusion model was created by the researchers and engineers from CompVis, Stability AI, and LAION. It is used to enhance the resolution of input images by a factor of 4.
To generate RGB and depth images with Stable Diffusion Upscale on Gaudi, you need to instantiate two instances:
Copied
Outputs can be PIL images or Numpy arrays. See all the parameters you can set to tailor generations to your taste.
Check out the provided in the official Github repository.
can be used with the exact same classes. Here is an example:
use for generating 768x768 images
use for generating 512x512 images
See for more information.
A pipeline with .
A scheduler with . This scheduler has been optimized for Gaudi.
When initializing the pipeline, you have to specify use_habana=True
to deploy it on HPUs. Furthermore, to get the fastest possible generations you should enable HPU graphs with use_hpu_graphs=True
. Finally, you will need to specify a which can be downloaded from the BOINC AI Hub.