File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 4
4
import git
5
5
import json
6
6
import numpy as np
7
+ from pathlib import Path
7
8
8
9
from mixdiff import StableDiffusionTilingPipeline
9
10
89
90
image = pipe (** pipeargs )["sample" ][0 ]
90
91
ct = datetime .datetime .now ()
91
92
outname = f"{ ct } _{ prompt [0 ][0 ][0 :100 ]} _{ tile_height } x{ tile_width } _sche{ sche } _seed{ seed_image } _gc{ gc_image } _steps{ steps_image } "
92
- image .save (f"outputs/{ outname } .png" )
93
- with open (f"logs/{ outname } .json" , "w" ) as f :
93
+ outpath = "./outputs"
94
+ Path (outpath ).mkdir (parents = True , exist_ok = True )
95
+ image .save (f"{ outpath } /{ outname } .png" )
96
+ logspath = "./logs"
97
+ Path (logspath ).mkdir (parents = True , exist_ok = True )
98
+ with open (f"{ logspath } /{ outname } .json" , "w" ) as f :
94
99
json .dump (
95
100
{
96
101
"prompt" : prompt ,
Original file line number Diff line number Diff line change 2
2
import datetime
3
3
from diffusers import LMSDiscreteScheduler , DDIMScheduler
4
4
import json
5
+ from pathlib import Path
5
6
import torch
6
7
7
8
from mixdiff .tiling import StableDiffusionTilingPipeline
@@ -34,7 +35,9 @@ def generate_grid(generation_arguments):
34
35
if "seed_reroll_regions" in generation_arguments : pipeargs = {** pipeargs , "seed_reroll_regions" : generation_arguments ["seed_reroll_regions" ]}
35
36
image = pipe (** pipeargs )["sample" ][0 ]
36
37
outname = "output"
37
- image .save (f"outputs/{ outname } .png" )
38
+ outpath = "./outputs"
39
+ Path (outpath ).mkdir (parents = True , exist_ok = True )
40
+ image .save (f"{ outpath } /{ outname } .png" )
38
41
39
42
if __name__ == "__main__" :
40
43
parser = argparse .ArgumentParser (description = 'Generate a stable diffusion grid using a JSON file with all configuration parameters.' )
You can’t perform that action at this time.
0 commit comments