Views
No views yet
git clone https://github.com/LifuWang-66/DistillT5.git
cd DistillT5
conda create -n distillt5 python=3.12
conda activate distillt5
pip install -r requirements.txt
pip install ./diffusers1import sys
2import os
3sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
4from models.T5_encoder import T5EncoderWithProjection
5import torch
6from diffusers import FluxPipeline
7
8
9pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16)
10text_encoder = T5EncoderWithProjection.from_pretrained('LifuWang/DistillT5-Small', torch_dtype=torch.float16)
11pipe.text_encoder_2 = text_encoder
12pipe = pipe.to('cuda')
13
14prompt = "Photorealistic portrait of a stylish young woman wearing a futuristic golden sequined bodysuit that catches the light, creating a metallic, mirror-like effect. She is wearing large, reflective blue-tinted aviator sunglasses. Over her head, she wears headphones with metallic accents, giving a modern, cyber aesthetic."
15
16image = pipe(prompt=prompt, num_images_per_prompt=1, guidance_scale=3.5, num_inference_steps=20).images[0]
17
18image.save("t5_small.png")