Views
No views yet

pip install git+https://github.com/huggingface/diffusers.git transformers==4.42.4 accelerate xformers peft sentencepiece protobuf -q1import numpy as np
2import random
3import torch
4from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler, AutoencoderTiny, AutoencoderKL
5from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5TokenizerFast
6
7dtype = torch.bfloat16
8device = "cuda" if torch.cuda.is_available() else "cpu"
9
10taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
11pipe = DiffusionPipeline.from_pretrained("mann-e/mann-e_flux", torch_dtype=dtype, vae=taef1).to(device)
12torch.cuda.empty_cache()
13
14MAX_SEED = np.iinfo(np.int32).max
15MAX_IMAGE_SIZE = 2048
16
17seed = random.randint(0, MAX_SEED)
18generator = torch.Generator().manual_seed(seed)
19
20prompt = "an astronaut riding a horse"
21
22pipe(
23 prompt=f"{prompt}",
24 guidance_scale=3.5,
25 num_inference_steps=10,
26 width=720,
27 height=1280,
28 generator=generator,
29 output_type="pil"
30 ).images[0].save("output.png")mj-v6.1-style to the prompts specially the cinematic and photo realistic prompts can make the result quality high as hell! Give it a try.guidance_scale is somewhere between 3.5 and 5.0