diff --git a/docs/source/en/using-diffusers/loading.md b/docs/source/en/using-diffusers/loading.md index a45667fdc464..d48004d7400c 100644 --- a/docs/source/en/using-diffusers/loading.md +++ b/docs/source/en/using-diffusers/loading.md @@ -95,6 +95,23 @@ Use the Space below to gauge a pipeline's memory requirements before you downloa > +### Specifying Component-Specific Data Types + +You can customize the data types for individual sub-models by passing a dictionary to the `torch_dtype` parameter. This allows you to load different components of a pipeline in different floating point precisions. For instance, if you want to load the transformer with `torch.bfloat16` and all other components with `torch.float16`, you can pass a dictionary mapping: + +```python +from diffusers import HunyuanVideoPipeline +import torch + +pipe = HunyuanVideoPipeline.from_pretrained( + "hunyuanvideo-community/HunyuanVideo", + torch_dtype={'transformer': torch.bfloat16, 'default': torch.float16}, +) +print(pipe.transformer.dtype, pipe.vae.dtype) # (torch.bfloat16, torch.float16) +``` + +If a component is not explicitly specified in the dictionary and no `default` is provided, it will be loaded with `torch.float32`. + ### Local pipeline To load a pipeline locally, use [git-lfs](https://git-lfs.github.com/) to manually download a checkpoint to your local disk.