forked from Eco-Sphere/cache-dit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_auraflow.py
More file actions
46 lines (34 loc) · 934 Bytes
/
run_auraflow.py
File metadata and controls
46 lines (34 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import sys
sys.path.append("..")
import time
import torch
from diffusers import AuraFlowPipeline
from utils import get_args, strify, cachify
import cache_dit
args = get_args()
print(args)
model_id = os.environ.get("AURAFLOW_DIR", "fal/AuraFlow-v0.3")
pipe = AuraFlowPipeline.from_pretrained(
model_id,
torch_dtype=torch.float16,
use_safetensors=True,
).to("cuda")
if args.cache:
cachify(args, pipe)
start = time.time()
image = pipe(
prompt="rempage of the iguana character riding F1, fast and furious, cinematic movie poster",
width=1536,
height=768,
num_inference_steps=50,
generator=torch.Generator("cpu").manual_seed(1),
guidance_scale=3.5,
).images[0]
end = time.time()
stats = cache_dit.summary(pipe)
time_cost = end - start
save_path = f"auraflow.{strify(args, stats)}.png"
print(f"Time cost: {time_cost:.2f}s")
print(f"Saving to {save_path}")
image.save(save_path)