Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/optimizedSD/optimized_txt2img.py b/optimizedSD/optimized_txt2img.py
- index a52cb61..11a1c31 100644
- --- a/optimizedSD/optimized_txt2img.py
- +++ b/optimizedSD/optimized_txt2img.py
- @@ -158,7 +158,6 @@ sample_path = os.path.join(outpath, "_".join(opt.prompt.split()))[:255]
- os.makedirs(sample_path, exist_ok=True)
- base_count = len(os.listdir(sample_path))
- grid_count = len(os.listdir(outpath)) - 1
- -seed_everything(opt.seed)
- sd = load_model_from_config(f"{ckpt}")
- li = []
- @@ -230,6 +229,7 @@ with torch.no_grad():
- all_samples = list()
- for n in trange(opt.n_iter, desc="Sampling"):
- for prompts in tqdm(data, desc="data"):
- + seed_everything(opt.seed)
- with precision_scope("cuda"):
- modelCS.to(device)
- uc = None
- @@ -265,7 +265,7 @@ with torch.no_grad():
- # for x_sample in x_samples_ddim:
- x_sample = 255. * rearrange(x_sample[0].cpu().numpy(), 'c h w -> h w c')
- Image.fromarray(x_sample.astype(np.uint8)).save(
- - os.path.join(sample_path, f"{base_count:05}.png"))
- + os.path.join(sample_path, f"{base_count:05}_seed-{opt.seed}_scale-{opt.scale}_steps-{opt.ddim_steps}_{i:03}.png"))
- base_count += 1
- @@ -289,7 +289,8 @@ with torch.no_grad():
- # grid = 255. * rearrange(grid, 'c h w -> h w c').cpu().numpy()
- # Image.fromarray(grid.astype(np.uint8)).save(os.path.join(outpath, f'grid-{grid_count:04}.png'))
- # grid_count += 1
- + opt.seed += 1
- toc = time.time()
- time_taken = (toc-tic)/60.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement