@@ -123,7 +123,7 @@ stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, safety_checker=Non
123123
124124### Reuse components across pipelines
125125
126- You can also reuse the same components in multiple pipelines without loading the weights into RAM twice. Use the [`DiffusionPipeline.components`] method to save the components in `components` :
126+ You can also reuse the same components in multiple pipelines to avoid loading the weights into RAM twice. Use the [`~ DiffusionPipeline.components`] method to save the components:
127127
128128```python
129129from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
@@ -140,6 +140,25 @@ Then you can pass the `components` to another pipeline without reloading the wei
140140stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(**components)
141141```
142142
143+ You can also pass the components individually to the pipeline if you want more flexibility over which components to reuse or disable. For example, to reuse the same components in the text-to-image pipeline, except for the safety checker and feature extractor, in the image-to-image pipeline:
144+
145+ ```py
146+ from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
147+
148+ model_id = " runwayml/stable-diffusion-v1-5"
149+ stable_diffusion_txt2img = StableDiffusionPipeline.from_pretrained(model_id)
150+ stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(
151+ vae =stable_diffusion_txt2img.vae,
152+ text_encoder =stable_diffusion_txt2img.text_encoder,
153+ tokenizer =stable_diffusion_txt2img.tokenizer,
154+ unet =stable_diffusion_txt2img.unet,
155+ scheduler =stable_diffusion_txt2img.scheduler,
156+ safety_checker =None,
157+ feature_extractor =None,
158+ requires_safety_checker =False,
159+ )
160+ ```
161+
143162## Checkpoint variants
144163
145164A checkpoint variant is usually a checkpoint where it's weights are:
0 commit comments