r=None,
    device_map="auto"
) Now, use the pipe to encode a prompt:   Copied with torch.no_grad():
    prompt = "cute cat"
    prompt_embeds, prompt_attention_mask, negative_embeds, negative_prompt_attention_mask = pipe.encode_prompt(prompt) Since text embeddings have been computed, remove the text_encoder and pipe from the memory, and free up som GPU VRAM:   Copied import gc 

def flush():
    gc.collect()
    torch.cuda.empty_cache()

del t