File size: 921 Bytes
d895063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import torch
import random
from pipeline_flux import FluxPipeline # use our modifed flux pipeline to ensure close-loop.

lora_path="lora_hubs/pano_lora_720*1440_v1.safetensors" # download panorama lora in our huggingface repo and replace it to your path.
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16).to("cuda")
pipe.load_lora_weights(lora_path) # change this.
pipe.enable_model_cpu_offload()  # save some VRAM by offloading the model to CPU

prompt = 'A vibrant city avenue, bustling traffic, towering skyscrapers'

pipe.enable_vae_tiling()
seed = 119223

#Select the same resolution as LoRA for inference
image = pipe(prompt, 
            height=720,
            width=1440,
            generator=torch.Generator("cpu").manual_seed(seed),
            num_inference_steps=50, 
            blend_extend=6,
            guidance_scale=7).images[0]

image.save("result.png")