diff --git a/docs/source/en/quantization/torchao.md b/docs/source/en/quantization/torchao.md index 8008e87251..a493cc830b 100644 --- a/docs/source/en/quantization/torchao.md +++ b/docs/source/en/quantization/torchao.md @@ -102,8 +102,7 @@ import torch from diffusers import AutoModel, TorchAoConfig quantization_config = TorchAoConfig("int8wo") -transformer = from diffusers import AutoModel, TorchAoConfig -.from_pretrained( +transformer = AutoModel.from_pretrained( "black-forest-labs/Flux.1-Dev", subfolder="transformer", quantization_config=quantization_config, @@ -151,11 +150,8 @@ with init_empty_weights(): transformer.load_state_dict(state_dict, strict=True, assign=True) ``` - - -With Torch 2.6 or higher, you can directly do: `transformer = AutoModel.from_pretrained("/path/to/flux_uint4wo/")`. - - +> [!TIP] +> The [`AutoModel`] API is supported for PyTorch >= 2.6 as shown in the examples below. ## Resources diff --git a/docs/source/en/quicktour.md b/docs/source/en/quicktour.md index 12e3d71fd5..14f567d461 100644 --- a/docs/source/en/quicktour.md +++ b/docs/source/en/quicktour.md @@ -163,11 +163,8 @@ Models are initiated with the [`~ModelMixin.from_pretrained`] method which also >>> model = UNet2DModel.from_pretrained(repo_id, use_safetensors=True) ``` - - -Use `AutoModel` from `from diffusers import AutoModel` in case you are unsure which model class to use. - - +> [!TIP] +> Use the [`AutoModel`] API to automatically select a model class if you're unsure of which one to use. To access the model parameters, call `model.config`: diff --git a/docs/source/en/using-diffusers/loading_adapters.md b/docs/source/en/using-diffusers/loading_adapters.md index b6d606afa4..3400774e6b 100644 --- a/docs/source/en/using-diffusers/loading_adapters.md +++ b/docs/source/en/using-diffusers/loading_adapters.md @@ -134,7 +134,7 @@ The [`~loaders.StableDiffusionLoraLoaderMixin.load_lora_weights`] method loads L - the LoRA weights don't have separate identifiers for the UNet and text encoder - the LoRA weights have separate identifiers for the UNet and text encoder -To directly load (and save) a LoRA adapter at the *model-level*, use [`~loaders.PeftAdapterMixin.load_lora_adapter`], which builds and prepares the necessary model configuration for the adapter. Like [`~loaders.StableDiffusionLoraLoaderMixin.load_lora_weights`], [`~loaders.PeftAdapterMixin.load_lora_adapter`] can load LoRAs for both the UNet and text encoder. For example, if you're loading a LoRA for the UNet, [`loaders.PeftAdapterMixin.load_lora_adapter`] ignores the keys for the text encoder. +To directly load (and save) a LoRA adapter at the *model-level*, use [`~loaders.PeftAdapterMixin.load_lora_adapter`], which builds and prepares the necessary model configuration for the adapter. Like [`~loaders.StableDiffusionLoraLoaderMixin.load_lora_weights`], [`~loaders.PeftAdapterMixin.load_lora_adapter`] can load LoRAs for both the UNet and text encoder. For example, if you're loading a LoRA for the UNet, [`~loaders.PeftAdapterMixin.load_lora_adapter`] ignores the keys for the text encoder. Use the `weight_name` parameter to specify the specific weight file and the `prefix` parameter to filter for the appropriate state dicts (`"unet"` in this case) to load.