text stringlengths 0 5.54k |
|---|
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. text_encoder (ClapTextModelWithProjection) β |
Frozen text-encoder (ClapTextModelWithProjection, specifically the |
laion/clap-htsat-unfused variant. tokenizer (PreTrainedTokenizer) β |
A RobertaTokenizer to tokenize text. unet (UNet2DConditionModel) β |
A UNet2DConditionModel to denoise the encoded audio latents. scheduler (SchedulerMixin) β |
A scheduler to be used in combination with unet to denoise the encoded audio latents. Can be one of |
DDIMScheduler, LMSDiscreteScheduler, or PNDMScheduler. vocoder (SpeechT5HifiGan) β |
Vocoder of class SpeechT5HifiGan. Pipeline for text-to-audio generation using AudioLDM. 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.). __call__ < source > ( prompt: Union = None audio_length_in_s: Optional = None num_inference_steps: int = 10 guidance_scale: float = 2.5 negative_prompt: Union = None num_waveforms_per_prompt: Optional = 1 eta: float = 0.0 gener... |
The prompt or prompts to guide audio generation. If not defined, you need to pass prompt_embeds. audio_length_in_s (int, optional, defaults to 5.12) β |
The length of the generated audio sample in seconds. num_inference_steps (int, optional, defaults to 10) β |
The number of denoising steps. More denoising steps usually lead to a higher quality audio at the |
expense of slower inference. guidance_scale (float, optional, defaults to 2.5) β |
A higher guidance scale value encourages the model to generate audio that is closely linked to the text |
prompt at the expense of lower sound 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 audio generation. If not defined, you need to |
pass negative_prompt_embeds instead. Ignored when not using guidance (guidance_scale < 1). num_waveforms_per_prompt (int, optional, defaults to 1) β |
The number of waveforms 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. return_dict (bool, optional, defaults to True) β |
Whether or not to return a AudioPipelineOutput 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. output_type (str, optional, defaults to "np") β |
The output format of the generated image. Choose between "np" to return a NumPy np.ndarray or |
"pt" to return a PyTorch torch.Tensor object. Returns |
AudioPipelineOutput or tuple |
If return_dict is True, AudioPipelineOutput is returned, otherwise a tuple is |
returned where the first element is a list with the generated audio. |
The call function to the pipeline for generation. Examples: Copied >>> from diffusers import AudioLDMPipeline |
>>> import torch |
>>> import scipy |
>>> repo_id = "cvssp/audioldm-s-full-v2" |
>>> pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch.float16) |
>>> pipe = pipe.to("cuda") |
>>> prompt = "Techno music with a strong, upbeat tempo and high melodic riffs" |
>>> audio = pipe(prompt, num_inference_steps=10, audio_length_in_s=5.0).audios[0] |
>>> # save the audio sample as a .wav file |
>>> scipy.io.wavfile.write("techno.wav", rate=16000, data=audio) disable_vae_slicing < source > ( ) Disable sliced VAE decoding. If enable_vae_slicing was previously enabled, this method will go back to |
computing decoding in one step. enable_vae_slicing < source > ( ) Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to |
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes. AudioPipelineOutput class diffusers.AudioPipelineOutput < source > ( audios: ndarray ) Parameters audios (np.ndarray) β |
List of denoised audio samples of a NumPy array of shape (batch_size, num_channels, sample_rate). Output class for audio pipelines. |
Image-to-Video Generation with PIA (Personalized Image Animator) Overview PIA: Your Personalized Image Animator via Plug-and-Play Modules in Text-to-Image Models by Yiming Zhang, Zhening Xing, Yanhong Zeng, Youqing Fang, Kai Chen Recent advancements in personalized text-to-image (T2I) models have revolutionized conten... |
from diffusers import ( |
EulerDiscreteScheduler, |
MotionAdapter, |
PIAPipeline, |
) |
from diffusers.utils import export_to_gif, load_image |
adapter = MotionAdapter.from_pretrained("openmmlab/PIA-condition-adapter") |
pipe = PIAPipeline.from_pretrained("SG161222/Realistic_Vision_V6.0_B1_noVAE", motion_adapter=adapter, torch_dtype=torch.float16) |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config) |
pipe.enable_model_cpu_offload() |
pipe.enable_vae_slicing() |
image = load_image( |
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/pix2pix/cat_6.png?download=true" |
) |
image = image.resize((512, 512)) |
prompt = "cat in a field" |
negative_prompt = "wrong white balance, dark, sketches,worst quality,low quality" |
generator = torch.Generator("cpu").manual_seed(0) |
output = pipe(image=image, prompt=prompt, generator=generator) |
frames = output.frames[0] |
export_to_gif(frames, "pia-animation.gif") Here are some sample outputs: masterpiece, bestquality, sunset. |
If you plan on using a scheduler that can clip samples, make sure to disable it by setting clip_sample=False in the scheduler as this can also have an adverse effect on generated samples. Additionally, the PIA checkpoints can be sensitive to the beta schedule of the scheduler. We recommend setting this to lin... |
from diffusers import ( |
DDIMScheduler, |
MotionAdapter, |
PIAPipeline, |
) |
from diffusers.utils import export_to_gif, load_image |
adapter = MotionAdapter.from_pretrained("openmmlab/PIA-condition-adapter") |
pipe = PIAPipeline.from_pretrained("SG161222/Realistic_Vision_V6.0_B1_noVAE", motion_adapter=adapter) |
# enable FreeInit |
# Refer to the enable_free_init documentation for a full list of configurable parameters |
pipe.enable_free_init(method="butterworth", use_fast_sampling=True) |
# Memory saving options |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.