Views
No views yet

Ultra-Resolution Adaptation with Ease
Ruonan Yu*, Songhua Liu*, Zhenxiong Tan, and Xinchao Wang
xML Lab, National University of Singapore
1git clone https://github.com/Huage001/URAE.git
2cd URAE1import torch
2- from diffusers import FluxPipeline
3+ from pipeline_flux import FluxPipeline
4+ from transformer_flux import FluxTransformer2DModel
5
6bfl_repo = "black-forest-labs/FLUX.1-dev"
7+ transformer = FluxTransformer2DModel.from_pretrained(bfl_repo, subfolder="transformer", torch_dtype=torch.bfloat16)
8- pipe = FluxPipeline.from_pretrained(bfl_repo, torch_dtype=torch.bfloat16)
9+ pipe = FluxPipeline.from_pretrained(bfl_repo, transformer=transformer, torch_dtype=torch.bfloat16)
10+ pipe.scheduler.config.use dynamic_shifting = False
11+ pipe.scheduler.config.time shift = 10
12pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
13
14+ pipe.load_lora_weights("Huage001/URAE", weight_name="urae_2k_adapter.safetensors")
15
16prompt = "An astronaut riding a green horse"
17image = pipe(
18 prompt,
19- height=1024,
20- width=1024,
21+ height=2048,
22+ width=2048,
23 guidance_scale=3.5,
24 num_inference_steps=50,
25 max_sequence_length=512,
26 generator=torch.Generator("cpu").manual_seed(0)
27).images[0]
28image.save("flux-urae.png")