Skip to content

Commit e51862b

Browse files
authored
[Docs] Fix typos (#7118)
Fix typos, formatting and remove trailing whitespace
1 parent 8492db2 commit e51862b

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

docs/source/en/using-diffusers/ip_adapter.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ Create a text prompt and load an image prompt before passing them to the pipelin
4848
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_adapter_diner.png")
4949
generator = torch.Generator(device="cpu").manual_seed(0)
5050
images = pipeline(
51-
prompt="a polar bear sitting in a chair drinking a milkshake",
51+
prompt="a polar bear sitting in a chair drinking a milkshake",
5252
ip_adapter_image=image,
5353
negative_prompt="deformed, ugly, wrong proportion, low res, bad anatomy, worst quality, low quality",
54-
num_inference_steps=100,
54+
num_inference_steps=100,
5555
generator=generator,
5656
).images
5757
images[0]
@@ -270,7 +270,7 @@ generator = torch.Generator(device="cpu").manual_seed(26)
270270
image = pipeline(
271271
prompt="A photo of Einstein as a chef, wearing an apron, cooking in a French restaurant",
272272
ip_adapter_image=image,
273-
negative_prompt="lowres, bad anatomy, worst quality, low quality",
273+
negative_prompt="lowres, bad anatomy, worst quality, low quality",
274274
num_inference_steps=100,
275275
generator=generator,
276276
).images[0]
@@ -304,7 +304,7 @@ from transformers import CLIPVisionModelWithProjection
304304
from diffusers.utils import load_image
305305

306306
image_encoder = CLIPVisionModelWithProjection.from_pretrained(
307-
"h94/IP-Adapter",
307+
"h94/IP-Adapter",
308308
subfolder="models/image_encoder",
309309
torch_dtype=torch.float16,
310310
)
@@ -323,8 +323,8 @@ pipeline = AutoPipelineForText2Image.from_pretrained(
323323
)
324324
pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)
325325
pipeline.load_ip_adapter(
326-
"h94/IP-Adapter",
327-
subfolder="sdxl_models",
326+
"h94/IP-Adapter",
327+
subfolder="sdxl_models",
328328
weight_name=["ip-adapter-plus_sdxl_vit-h.safetensors", "ip-adapter-plus-face_sdxl_vit-h.safetensors"]
329329
)
330330
pipeline.set_ip_adapter_scale([0.7, 0.3])
@@ -336,7 +336,7 @@ Load an image prompt and a folder containing images of a certain style you want
336336
```py
337337
face_image = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/women_input.png")
338338
style_folder = "https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/style_ziggy"
339-
style_images = [load_image(f"{style_folder}/img{i}.png") for i in range(10)]
339+
style_images = [load_image(f"{style_folder}/img{i}.png") for i in range(10)]
340340
```
341341

342342
<div class="flex flex-row gap-4">
@@ -358,10 +358,11 @@ generator = torch.Generator(device="cpu").manual_seed(0)
358358
image = pipeline(
359359
prompt="wonderwoman",
360360
ip_adapter_image=[style_images, face_image],
361-
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
361+
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
362362
num_inference_steps=50, num_images_per_prompt=1,
363363
generator=generator,
364364
).images[0]
365+
image
365366
```
366367

367368
<div class="flex justify-center">
@@ -379,14 +380,14 @@ from diffusers import DiffusionPipeline, LCMScheduler
379380
import torch
380381
from diffusers.utils import load_image
381382

382-
model_id = "sd-dreambooth-library/herge-style"
383+
model_id = "sd-dreambooth-library/herge-style"
383384
lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
384385

385386
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
386387

387388
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin")
388389
pipeline.load_lora_weights(lcm_lora_id)
389-
pipeline.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
390+
pipeline.scheduler = LCMScheduler.from_config(pipeline.scheduler.config)
390391
pipeline.enable_model_cpu_offload()
391392
```
392393

@@ -455,13 +456,13 @@ Pass the depth map and IP-Adapter image to the pipeline to generate an image.
455456
```py
456457
generator = torch.Generator(device="cpu").manual_seed(33)
457458
image = pipeline(
458-
prompt="best quality, high quality",
459+
prompt="best quality, high quality",
459460
image=depth_map,
460461
ip_adapter_image=ip_adapter_image,
461-
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
462+
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
462463
num_inference_steps=50,
463464
generator=generator,
464-
).image[0]
465+
).images[0]
465466
image
466467
```
467468

@@ -511,8 +512,7 @@ If you have more than one IP-Adapter image, load them into a list, ensuring each
511512
face_image1 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl1.png")
512513
face_image2 = load_image("https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip_mask_girl2.png")
513514

514-
ip_images =[[image1], [image2]]
515-
515+
ip_images = [[face_image1], [face_image2]]
516516
```
517517

518518
<div class="flex flex-row gap-4">
@@ -529,19 +529,19 @@ ip_images =[[image1], [image2]]
529529
Pass preprocessed masks to the pipeline using `cross_attention_kwargs` as shown below:
530530

531531
```py
532-
533532
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus-face_sdxl_vit-h.safetensors"] * 2)
534533
pipeline.set_ip_adapter_scale([0.7] * 2)
535534
generator = torch.Generator(device="cpu").manual_seed(0)
536-
num_images=1
535+
num_images = 1
537536

538537
image = pipeline(
539538
prompt="2 girls",
540539
ip_adapter_image=ip_images,
541-
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
542-
num_inference_steps=20, num_images_per_prompt=num_images,
540+
negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
541+
num_inference_steps=20, num_images_per_prompt=num_images,
543542
generator=generator, cross_attention_kwargs={"ip_adapter_masks": masks}
544543
).images[0]
544+
image
545545
```
546546

547547
<div class="flex justify-center">

docs/source/en/using-diffusers/loading_adapters.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ Once loaded, you can use the pipeline with an image and text prompt to guide the
340340
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_neg_embed.png")
341341
generator = torch.Generator(device="cpu").manual_seed(33)
342342
images = pipeline(
343-
    prompt='best quality, high quality, wearing sunglasses',
343+
    prompt='best quality, high quality, wearing sunglasses',
344344
    ip_adapter_image=image,
345-
    negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
345+
    negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
346346
    num_inference_steps=50,
347347
    generator=generator,
348348
).images[0]
@@ -355,11 +355,13 @@ images
355355

356356
### IP-Adapter Plus
357357

358-
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.
358+
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.
359359

360360
This is the case for *IP-Adapter Plus* checkpoints which use the ViT-H image encoder.
361361

362362
```py
363+
from transformers import CLIPVisionModelWithProjection
364+
363365
image_encoder = CLIPVisionModelWithProjection.from_pretrained(
364366
"h94/IP-Adapter",
365367
subfolder="models/image_encoder",

0 commit comments

Comments
 (0)