Niansuh commited on
Commit
e43b362
1 Parent(s): f082f11

Update custom_pipeline.py

Browse files
Files changed (1) hide show
  1. custom_pipeline.py +10 -0
custom_pipeline.py CHANGED
@@ -64,14 +64,17 @@ EXAMPLE_DOC_STRING = """
64
  >>> import torch
65
  >>> from diffusers import StableDiffusionXLInstructPix2PixPipeline
66
  >>> from diffusers.utils import load_image
 
67
  >>> resolution = 768
68
  >>> image = load_image(
69
  ... "https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
70
  ... ).resize((resolution, resolution))
71
  >>> edit_instruction = "Turn sky into a cloudy one"
 
72
  >>> pipe = StableDiffusionXLInstructPix2PixPipeline.from_pretrained(
73
  ... "diffusers/sdxl-instructpix2pix-768", torch_dtype=torch.float16
74
  ... ).to("cuda")
 
75
  >>> edited_image = pipe(
76
  ... prompt=edit_instruction,
77
  ... image=image,
@@ -123,13 +126,16 @@ class CosStableDiffusionXLInstructPix2PixPipeline(
123
  ):
124
  r"""
125
  Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion XL.
 
126
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
127
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
 
128
  The pipeline also inherits the following loading methods:
129
  - [`~loaders.TextualInversionLoaderMixin.load_textual_inversion`] for loading textual inversion embeddings
130
  - [`~loaders.FromSingleFileMixin.from_single_file`] for loading `.ckpt` files
131
  - [`~loaders.StableDiffusionXLLoraLoaderMixin.load_lora_weights`] for loading LoRA weights
132
  - [`~loaders.StableDiffusionXLLoraLoaderMixin.save_lora_weights`] for saving LoRA weights
 
133
  Args:
134
  vae ([`AutoencoderKL`]):
135
  Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
@@ -220,6 +226,7 @@ class CosStableDiffusionXLInstructPix2PixPipeline(
220
  ):
221
  r"""
222
  Encodes the prompt into text encoder hidden states.
 
223
  Args:
224
  prompt (`str` or `List[str]`, *optional*):
225
  prompt to be encoded
@@ -621,6 +628,7 @@ class CosStableDiffusionXLInstructPix2PixPipeline(
621
  ):
622
  r"""
623
  Function invoked when calling the pipeline for generation.
 
624
  Args:
625
  prompt (`str` or `List[str]`, *optional*):
626
  The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
@@ -731,7 +739,9 @@ class CosStableDiffusionXLInstructPix2PixPipeline(
731
  Part of SDXL's micro-conditioning as explained in section 2.2 of
732
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). Can be used to
733
  simulate an aesthetic score of the generated image by influencing the negative text condition.
 
734
  Examples:
 
735
  Returns:
736
  [`~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`] or `tuple`:
737
  [`~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`] if `return_dict` is True, otherwise a
 
64
  >>> import torch
65
  >>> from diffusers import StableDiffusionXLInstructPix2PixPipeline
66
  >>> from diffusers.utils import load_image
67
+
68
  >>> resolution = 768
69
  >>> image = load_image(
70
  ... "https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
71
  ... ).resize((resolution, resolution))
72
  >>> edit_instruction = "Turn sky into a cloudy one"
73
+
74
  >>> pipe = StableDiffusionXLInstructPix2PixPipeline.from_pretrained(
75
  ... "diffusers/sdxl-instructpix2pix-768", torch_dtype=torch.float16
76
  ... ).to("cuda")
77
+
78
  >>> edited_image = pipe(
79
  ... prompt=edit_instruction,
80
  ... image=image,
 
126
  ):
127
  r"""
128
  Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion XL.
129
+
130
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
131
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
132
+
133
  The pipeline also inherits the following loading methods:
134
  - [`~loaders.TextualInversionLoaderMixin.load_textual_inversion`] for loading textual inversion embeddings
135
  - [`~loaders.FromSingleFileMixin.from_single_file`] for loading `.ckpt` files
136
  - [`~loaders.StableDiffusionXLLoraLoaderMixin.load_lora_weights`] for loading LoRA weights
137
  - [`~loaders.StableDiffusionXLLoraLoaderMixin.save_lora_weights`] for saving LoRA weights
138
+
139
  Args:
140
  vae ([`AutoencoderKL`]):
141
  Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
 
226
  ):
227
  r"""
228
  Encodes the prompt into text encoder hidden states.
229
+
230
  Args:
231
  prompt (`str` or `List[str]`, *optional*):
232
  prompt to be encoded
 
628
  ):
629
  r"""
630
  Function invoked when calling the pipeline for generation.
631
+
632
  Args:
633
  prompt (`str` or `List[str]`, *optional*):
634
  The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
 
739
  Part of SDXL's micro-conditioning as explained in section 2.2 of
740
  [https://huggingface.co/papers/2307.01952](https://huggingface.co/papers/2307.01952). Can be used to
741
  simulate an aesthetic score of the generated image by influencing the negative text condition.
742
+
743
  Examples:
744
+
745
  Returns:
746
  [`~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`] or `tuple`:
747
  [`~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput`] if `return_dict` is True, otherwise a