Unverified Commit e51862bb authored by M. Tolga Cangöz's avatar M. Tolga Cangöz Committed by GitHub
Browse files

[`Docs`] Fix typos (#7118)

Fix typos, formatting and remove trailing whitespace
parent 8492db23
...@@ -362,6 +362,7 @@ image = pipeline( ...@@ -362,6 +362,7 @@ image = pipeline(
num_inference_steps=50, num_images_per_prompt=1, num_inference_steps=50, num_images_per_prompt=1,
generator=generator, generator=generator,
).images[0] ).images[0]
image
``` ```
<div class="flex justify-center"> <div class="flex justify-center">
...@@ -386,7 +387,7 @@ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16 ...@@ -386,7 +387,7 @@ pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin") pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin")
pipeline.load_lora_weights(lcm_lora_id) pipeline.load_lora_weights(lcm_lora_id)
pipeline.scheduler = LCMScheduler.from_config(pipe.scheduler.config) pipeline.scheduler = LCMScheduler.from_config(pipeline.scheduler.config)
pipeline.enable_model_cpu_offload() pipeline.enable_model_cpu_offload()
``` ```
...@@ -461,7 +462,7 @@ image = pipeline( ...@@ -461,7 +462,7 @@ image = pipeline(
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality", negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
num_inference_steps=50, num_inference_steps=50,
generator=generator, generator=generator,
).image[0] ).images[0]
image image
``` ```
...@@ -511,8 +512,7 @@ If you have more than one IP-Adapter image, load them into a list, ensuring each ...@@ -511,8 +512,7 @@ If you have more than one IP-Adapter image, load them into a list, ensuring each
face_image1 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl1.png") face_image1 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl1.png")
face_image2 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl2.png") face_image2 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl2.png")
ip_images =[[image1], [image2]] ip_images = [[face_image1], [face_image2]]
``` ```
<div class="flex flex-row gap-4"> <div class="flex flex-row gap-4">
...@@ -529,11 +529,10 @@ ip_images =[[image1], [image2]] ...@@ -529,11 +529,10 @@ ip_images =[[image1], [image2]]
Pass preprocessed masks to the pipeline using `cross_attention_kwargs` as shown below: Pass preprocessed masks to the pipeline using `cross_attention_kwargs` as shown below:
```py ```py
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus-face_sdxl_vit-h.safetensors"] * 2) pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus-face_sdxl_vit-h.safetensors"] * 2)
pipeline.set_ip_adapter_scale([0.7] * 2) pipeline.set_ip_adapter_scale([0.7] * 2)
generator = torch.Generator(device="cpu").manual_seed(0) generator = torch.Generator(device="cpu").manual_seed(0)
num_images=1 num_images = 1
image = pipeline( image = pipeline(
prompt="2 girls", prompt="2 girls",
...@@ -542,6 +541,7 @@ image = pipeline( ...@@ -542,6 +541,7 @@ image = pipeline(
num_inference_steps=20, num_images_per_prompt=num_images, num_inference_steps=20, num_images_per_prompt=num_images,
generator=generator, cross_attention_kwargs={"ip_adapter_masks": masks} generator=generator, cross_attention_kwargs={"ip_adapter_masks": masks}
).images[0] ).images[0]
image
``` ```
<div class="flex justify-center"> <div class="flex justify-center">
......
...@@ -355,11 +355,13 @@ images ...@@ -355,11 +355,13 @@ images
### IP-Adapter Plus ### IP-Adapter Plus
IP-Adapter relies on an image encoder to generate image features. If the IP-Adapter repository contains a `image_encoder` subfolder, the image encoder is automatically loaded and registed to the pipeline. Otherwise, you'll need to explicitly load the image encoder with a [`~transformers.CLIPVisionModelWithProjection`] model and pass it to the pipeline. IP-Adapter relies on an image encoder to generate image features. If the IP-Adapter repository contains an `image_encoder` subfolder, the image encoder is automatically loaded and registered to the pipeline. Otherwise, you'll need to explicitly load the image encoder with a [`~transformers.CLIPVisionModelWithProjection`] model and pass it to the pipeline.
This is the case for *IP-Adapter Plus* checkpoints which use the ViT-H image encoder. This is the case for *IP-Adapter Plus* checkpoints which use the ViT-H image encoder.
```py ```py
from transformers import CLIPVisionModelWithProjection
image_encoder = CLIPVisionModelWithProjection.from_pretrained( image_encoder = CLIPVisionModelWithProjection.from_pretrained(
"h94/IP-Adapter", "h94/IP-Adapter",
subfolder="models/image_encoder", subfolder="models/image_encoder",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment