HaileyStorm commited on
Commit
52b7cdb
·
verified ·
1 Parent(s): 6aed0bf

Update infer.py

Browse files
Files changed (1) hide show
  1. infer.py +17 -11
infer.py CHANGED
@@ -3,18 +3,23 @@ import torch
3
  import os
4
 
5
  # Configuration
6
- MODEL_DIR = "./merged_models/2.5_1"
7
- IMAGE_OUTPUT_DIR = "./"
8
- IMAGE_PREFIX = "flowers_2.5_1"
9
  DEVICE = torch.device("cpu")
10
  # If True, uses pipeline.enable_sequential_cpu_offload(). Make sure device is CPU.
11
  USE_CPU_OFFLOAD = True
12
- SEED = 0
13
- # At least 880x656 fits on 24GB GPU w/ sequential offload
14
- IMAGE_WIDTH = 1280
15
- IMAGE_HEIGHT = 1024
16
- NUM_STEPS = 10 # Try ~4-8 for 10:1 and ~8-16+ for 4:1 and 2.5:1 ("Default" 6, 10, 16)
17
- NUM_IMAGES = 4
 
 
 
 
 
18
  CFG = 3.5
19
  PROMPT = ("Impressionistic tableau medium shot painting with soft, blended brushstrokes and muted colors complemented "
20
  "by sporadic vibrant highlights.")
@@ -25,13 +30,14 @@ PROMPT2 = ("Impressionistic tableau painting with soft brushstrokes and muted co
25
  "cheekbones. Together, they exude harmony and intrigue, their contrasting features complementing each "
26
  "other.")
27
 
 
 
28
  print("Loading model...")
29
  transformer = FluxTransformer2DModel.from_pretrained(MODEL_DIR, torch_dtype=torch.bfloat16, use_safetensors=True)
30
  print("Creating pipeline...")
31
  pipeline = FluxPipeline.from_pretrained(
32
  "black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
33
- , use_safetensors=True, local_dir="./models/dev/", local_dir_use_symlinks=False,
34
- ignore_patterns=["flux1-dev.sft", "flux1-dev.safetensors"]).to(DEVICE)
35
  pipeline.enable_sequential_cpu_offload()
36
  print("Generating image...")
37
  # Params:
 
3
  import os
4
 
5
  # Configuration
6
+ MODEL_DIR = "./merged_models/10_1"
7
+ IMAGE_OUTPUT_DIR = "./young"
8
+ IMAGE_PREFIX = "ginny_10_1"
9
  DEVICE = torch.device("cpu")
10
  # If True, uses pipeline.enable_sequential_cpu_offload(). Make sure device is CPU.
11
  USE_CPU_OFFLOAD = True
12
+ SEED = 922733
13
+ # Fits on 24GB GPU w/ sequential offload:
14
+ # 6x 1024x768? (etc.)
15
+ # 4x 1280x1024 (etc.)
16
+ # 3x 1856x920 (or 1680x1016, 1704x1000, 1456x1168, etc.)
17
+ # 2x 1920x1080 (or 1x 1920x1440 / 2560x1080 or even 2560x1352, and yes huge works to varying degree)
18
+ IMAGE_WIDTH = 1680
19
+ IMAGE_HEIGHT = 1016
20
+ # Try ~4-8 for 10:1 and ~8-16+ for 4:1 and 2.5:1 ("Default" 6, 10, 12)
21
+ NUM_STEPS = 8
22
+ NUM_IMAGES = 3
23
  CFG = 3.5
24
  PROMPT = ("Impressionistic tableau medium shot painting with soft, blended brushstrokes and muted colors complemented "
25
  "by sporadic vibrant highlights.")
 
30
  "cheekbones. Together, they exude harmony and intrigue, their contrasting features complementing each "
31
  "other.")
32
 
33
+ os.makedirs(IMAGE_OUTPUT_DIR, exist_ok=True)
34
+
35
  print("Loading model...")
36
  transformer = FluxTransformer2DModel.from_pretrained(MODEL_DIR, torch_dtype=torch.bfloat16, use_safetensors=True)
37
  print("Creating pipeline...")
38
  pipeline = FluxPipeline.from_pretrained(
39
  "black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
40
+ , use_safetensors=True).to(DEVICE)
 
41
  pipeline.enable_sequential_cpu_offload()
42
  print("Generating image...")
43
  # Params: