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

del text_encoder
del pipe
flush()
```  
Then compute the latents with the prompt embeddings as inputs:  
```python
pipe = PixArtAlphaPipeline.from_pretrained(
"PixArt-alpha/PixArt-XL-2-1024-MS",
text_encoder=None,
torch_dtype=torch.float16,
).to("cuda")