text stringlengths 0 5.54k |
|---|
--learnable_property="object" \ |
--placeholder_token="<cat-toy>" \ |
--initializer_token="toy" \ |
--resolution=512 \ |
--train_batch_size=1 \ |
--gradient_accumulation_steps=4 \ |
--max_train_steps=3000 \ |
--learning_rate=5.0e-04 \ |
--scale_lr \ |
--lr_scheduler="constant" \ |
--lr_warmup_steps=0 \ |
--output_dir="textual_inversion_cat" \ |
--push_to_hub After training is complete, you can use your newly trained model for inference like: PyTorch Flax Copied from diffusers import StableDiffusionPipeline |
import torch |
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16).to("cuda") |
pipeline.load_textual_inversion("sd-concepts-library/cat-toy") |
image = pipeline("A <cat-toy> train", num_inference_steps=50).images[0] |
image.save("cat-train.png") Next steps Congratulations on training your own Textual Inversion model! π To learn more about how to use your new model, the following guides may be helpful: Learn how to load Textual Inversion embeddings and also use them as negative embeddings. Learn how to use Textual Inversion for in... |
ControlNet ControlNet was introduced in Adding Conditional Control to Text-to-Image Diffusion Models by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. With a ControlNet model, you can provide an additional control image to condition and control Stable Diffusion generation. For example, if you provide a depth map, the Con... |
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. text_encoder (CLIPTextModel) β |
Frozen text-encoder (clip-vit-large-patch14). tokenizer (CLIPTokenizer) β |
A CLIPTokenizer to tokenize text. unet (UNet2DConditionModel) β |
A UNet2DConditionModel to denoise the encoded image latents. controlnet (ControlNetModel or List[ControlNetModel]) β |
Provides additional conditioning to the unet during the denoising process. If you set multiple |
ControlNets as a list, the outputs from each ControlNet are added together to create one combined |
additional conditioning. scheduler (SchedulerMixin) β |
A scheduler to be used in combination with unet to denoise the encoded image latents. Can be one of |
DDIMScheduler, LMSDiscreteScheduler, or PNDMScheduler. safety_checker (StableDiffusionSafetyChecker) β |
Classification module that estimates whether generated images could be considered offensive or harmful. |
Please refer to the model card for more details |
about a modelβs potential harms. feature_extractor (CLIPImageProcessor) β |
A CLIPImageProcessor to extract features from generated images; used as inputs to the safety_checker. Pipeline for text-to-image generation using Stable Diffusion with ControlNet guidance. This model inherits from DiffusionPipeline. Check the superclass documentation for the generic methods |
implemented for all pipelines (downloading, saving, running on a particular device, etc.). The pipeline also inherits the following loading methods: load_textual_inversion() for loading textual inversion embeddings load_lora_weights() for loading LoRA weights save_lora_weights() for saving LoRA weights from_single_file... |
The prompt or prompts to guide image generation. If not defined, you need to pass prompt_embeds. image (torch.FloatTensor, PIL.Image.Image, np.ndarray, List[torch.FloatTensor], List[PIL.Image.Image], List[np.ndarray], β |
List[List[torch.FloatTensor]], List[List[np.ndarray]] or List[List[PIL.Image.Image]]): |
The ControlNet input condition to provide guidance to the unet for generation. If the type is |
specified as torch.FloatTensor, it is passed to ControlNet as is. PIL.Image.Image can also be |
accepted as an image. The dimensions of the output image defaults to imageβs dimensions. If height |
and/or width are passed, image is resized accordingly. If multiple ControlNets are specified in |
init, images must be passed as a list such that each element of the list can be correctly batched for |
input to a single ControlNet. When prompt is a list, and if a list of images is passed for a single ControlNet, |
each will be paired with each prompt in the prompt list. This also applies to multiple ControlNets, |
where a list of image lists can be passed to batch for each prompt and each ControlNet. height (int, optional, defaults to self.unet.config.sample_size * self.vae_scale_factor) β |
The height in pixels of the generated image. width (int, optional, defaults to self.unet.config.sample_size * self.vae_scale_factor) β |
The width in pixels of the generated image. num_inference_steps (int, optional, defaults to 50) β |
The number of denoising steps. More denoising steps usually lead to a higher quality image at the |
expense of slower inference. timesteps (List[int], optional) β |
Custom timesteps to use for the denoising process with schedulers which support a timesteps argument |
in their set_timesteps method. If not defined, the default behavior when num_inference_steps is |
passed will be used. Must be in descending order. guidance_scale (float, optional, defaults to 7.5) β |
A higher guidance scale value encourages the model to generate images closely linked to the text |
prompt at the expense of lower image quality. Guidance scale is enabled when guidance_scale > 1. negative_prompt (str or List[str], optional) β |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to |
pass negative_prompt_embeds instead. Ignored when not using guidance (guidance_scale < 1). num_images_per_prompt (int, optional, defaults to 1) β |
The number of images to generate per prompt. eta (float, optional, defaults to 0.0) β |
Corresponds to parameter eta (Ξ·) from the DDIM paper. Only applies |
to the DDIMScheduler, and is ignored in other schedulers. generator (torch.Generator or List[torch.Generator], optional) β |
A torch.Generator to make |
generation deterministic. latents (torch.FloatTensor, optional) β |
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image |
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents |
tensor is generated by sampling using the supplied random generator. prompt_embeds (torch.FloatTensor, optional) β |
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not |
provided, text embeddings are generated from the prompt input argument. negative_prompt_embeds (torch.FloatTensor, optional) β |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If |
not provided, negative_prompt_embeds are generated from the negative_prompt input argument. |
ip_adapter_image β (PipelineImageInput, optional): Optional image input to work with IP Adapters. ip_adapter_image_embeds (List[torch.FloatTensor], optional) β |
Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of IP-adapters. |
Each element should be a tensor of shape (batch_size, num_images, emb_dim). It should contain the negative image embedding |
if do_classifier_free_guidance is set to True. |
If not provided, embeddings are computed from the ip_adapter_image input argument. output_type (str, optional, defaults to "pil") β |
The output format of the generated image. Choose between PIL.Image or np.array. return_dict (bool, optional, defaults to True) β |
Whether or not to return a StableDiffusionPipelineOutput instead of a |
plain tuple. callback (Callable, optional) β |
A function that calls every callback_steps steps during inference. The function is called with the |
following arguments: callback(step: int, timestep: int, latents: torch.FloatTensor). callback_steps (int, optional, defaults to 1) β |
The frequency at which the callback function is called. If not specified, the callback is called at |
every step. cross_attention_kwargs (dict, optional) β |
A kwargs dictionary that if specified is passed along to the AttentionProcessor as defined in |
self.processor. controlnet_conditioning_scale (float or List[float], optional, defaults to 1.0) β |
The outputs of the ControlNet are multiplied by controlnet_conditioning_scale before they are added |
to the residual in the original unet. If multiple ControlNets are specified in init, you can set |
the corresponding scale as a list. guess_mode (bool, optional, defaults to False) β |
The ControlNet encoder tries to recognize the content of the input image even if you remove all |
prompts. A guidance_scale value between 3.0 and 5.0 is recommended. control_guidance_start (float or List[float], optional, defaults to 0.0) β |
The percentage of total steps at which the ControlNet starts applying. control_guidance_end (float or List[float], optional, defaults to 1.0) β |
The percentage of total steps at which the ControlNet stops applying. clip_skip (int, optional) β |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that |
the output of the pre-final layer will be used for computing the prompt embeddings. callback_on_step_end (Callable, optional) β |
A function that calls at the end of each denoising steps during the inference. The function is called |
with the following arguments: callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict). callback_kwargs will include a list of all tensors as specified by |
callback_on_step_end_tensor_inputs. callback_on_step_end_tensor_inputs (List, optional) β |
The list of tensor inputs for the callback_on_step_end function. The tensors specified in the list |
will be passed as callback_kwargs argument. You will only be able to include variables listed in the |
._callback_tensor_inputs attribute of your pipeine class. Returns |
StableDiffusionPipelineOutput or tuple |
If return_dict is True, StableDiffusionPipelineOutput is returned, |
otherwise a tuple is returned where the first element is a list with the generated images and the |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.