text stringlengths 0 5.54k |
|---|
Enable sliced attention computation. |
When this option is enabled, the attention module will split the input tensor in slices, to compute attention |
in several steps. This is useful to save some memory in exchange for a small speed decrease. |
disable_attention_slicing |
< |
source |
> |
( |
) |
Disable sliced attention computation. If enable_attention_slicing was previously invoked, this method will go |
back to computing attention in one step. |
enable_xformers_memory_efficient_attention |
< |
source |
> |
( |
attention_op: typing.Optional[typing.Callable] = None |
) |
Parameters |
attention_op (Callable, optional) — |
Override the default None operator for use as op argument to the |
memory_efficient_attention() |
function of xFormers. |
Enable memory efficient attention as implemented in xformers. |
When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference |
time. Speed up at training time is not guaranteed. |
Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention |
is used. |
Examples: |
Copied |
>>> import torch |
>>> from diffusers import DiffusionPipeline |
>>> from xformers.ops import MemoryEfficientAttentionFlashAttentionOp |
>>> pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16) |
>>> pipe = pipe.to("cuda") |
>>> pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp) |
>>> # Workaround for not accepting attention shape using VAE for Flash Attention |
>>> pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None) |
disable_xformers_memory_efficient_attention |
< |
source |
> |
( |
) |
Disable memory efficient attention as implemented in xformers. |
enable_sequential_cpu_offload |
< |
source |
> |
( |
gpu_id = 0 |
) |
Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet, |
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a |
torch.device('meta') and loaded to GPU only when their specific submodule has its forward` method called. |
MusicLDM MusicLDM was proposed in MusicLDM: Enhancing Novelty in Text-to-Music Generation Using Beat-Synchronous Mixup Strategies by Ke Chen, Yusong Wu, Haohe Liu, Marianna Nezhurina, Taylor Berg-Kirkpatrick, Shlomo Dubnov. |
MusicLDM takes a text prompt as input and predicts the corresponding music sample. Inspired by Stable Diffusion and AudioLDM, |
MusicLDM is a text-to-music latent diffusion model (LDM) that learns continuous audio representations from CLAP |
latents. MusicLDM is trained on a corpus of 466 hours of music data. Beat-synchronous data augmentation strategies are applied to the music samples, both in the time domain and in the latent space. Using beat-synchronous data augmentation strategies encourages the model to interpolate between the training samples, but ... |
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. text_encoder (ClapModel) — |
Frozen text-audio embedding model (ClapTextModel), specifically the |
laion/clap-htsat-unfused variant. tokenizer (PreTrainedTokenizer) — |
A RobertaTokenizer to tokenize text. feature_extractor (ClapFeatureExtractor) — |
Feature extractor to compute mel-spectrograms from audio waveforms. 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 MusicLDM. 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 = 200 guidance_scale: float = 2.0 negative_prompt: Union = None num_waveforms_per_prompt: Optional = 1 eta: float = 0.0 gene... |
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 10.24) — |
The length of the generated audio sample in seconds. num_inference_steps (int, optional, defaults to 200) — |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.