import torch from diffusers.pipelines import FluxPipeline from huggingface_hub import login import os token = os.getenv("FLUX_TOKEN") login(token=token) model_id = "black-forest-labs/FLUX.1-dev" adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha" pipe = FluxPipeline.from_pretrained( model_id, torch_dtype=torch.bfloat16 ) pipe.to("cuda") pipe.load_lora_weights(adapter_id) pipe.fuse_lora() prompt = "A DSLR photo of a shiny VW van that has a cityscape painted on it. A smiling sloth stands on grass in front of the van and is wearing a leather jacket, a cowboy hat, a kilt and a bowtie. The sloth is holding a quarterstaff and a big book." image = pipe( prompt=prompt, guidance_scale=3.5, height=1024, width=1024, num_inference_steps=8, max_sequence_length=512).images[0]