Advertisement
Guest User

filenames.patch

a guest
Aug 22nd, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.64 KB | None | 0 0
  1. diff --git a/optimizedSD/optimized_txt2img.py b/optimizedSD/optimized_txt2img.py
  2. index a52cb61..11a1c31 100644
  3. --- a/optimizedSD/optimized_txt2img.py
  4. +++ b/optimizedSD/optimized_txt2img.py
  5. @@ -158,7 +158,6 @@ sample_path = os.path.join(outpath, "_".join(opt.prompt.split()))[:255]
  6.  os.makedirs(sample_path, exist_ok=True)
  7.  base_count = len(os.listdir(sample_path))
  8.  grid_count = len(os.listdir(outpath)) - 1
  9. -seed_everything(opt.seed)
  10.  
  11.  sd = load_model_from_config(f"{ckpt}")
  12.  li = []
  13. @@ -230,6 +229,7 @@ with torch.no_grad():
  14.      all_samples = list()
  15.      for n in trange(opt.n_iter, desc="Sampling"):
  16.          for prompts in tqdm(data, desc="data"):
  17. +             seed_everything(opt.seed)
  18.               with precision_scope("cuda"):
  19.                  modelCS.to(device)
  20.                  uc = None
  21. @@ -265,7 +265,7 @@ with torch.no_grad():
  22.                  # for x_sample in x_samples_ddim:
  23.                      x_sample = 255. * rearrange(x_sample[0].cpu().numpy(), 'c h w -> h w c')
  24.                      Image.fromarray(x_sample.astype(np.uint8)).save(
  25. -                        os.path.join(sample_path, f"{base_count:05}.png"))
  26. +                        os.path.join(sample_path, f"{base_count:05}_seed-{opt.seed}_scale-{opt.scale}_steps-{opt.ddim_steps}_{i:03}.png"))
  27.                      base_count += 1
  28.  
  29.  
  30. @@ -289,7 +289,8 @@ with torch.no_grad():
  31.          #     grid = 255. * rearrange(grid, 'c h w -> h w c').cpu().numpy()
  32.          #     Image.fromarray(grid.astype(np.uint8)).save(os.path.join(outpath, f'grid-{grid_count:04}.png'))
  33.          #     grid_count += 1
  34. +        opt.seed += 1
  35.  
  36.  toc = time.time()
  37.  
  38.  time_taken = (toc-tic)/60.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement