Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Use single progress bar while sampling #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,10 @@ def save_and_sample_weights(step,context='checkpoint',save_model=True):
send_telegram_message(f"Generating samples for <b>{step}</b> {context}", args.telegram_chat_id, args.telegram_token)
except:
pass
n_sample = args.n_save_sample
if args.save_sample_controlled_seed:
n_sample += len(args.save_sample_controlled_seed)
progress_bar_sample = tqdm(range(len(prompts)*n_sample),desc="Generating samples")
for samplePrompt in prompts:
sampleIndex = prompts.index(samplePrompt)
#convert sampleIndex to number in words
Expand Down Expand Up @@ -1172,7 +1176,7 @@ def save_and_sample_weights(step,context='checkpoint',save_model=True):
depth = depth.astype(np.float32) / 255.0
depth = depth[None, None]
depth = torch.from_numpy(depth)
for i in tqdm(range(args.n_save_sample) if not args.save_sample_controlled_seed else range(args.n_save_sample+len(args.save_sample_controlled_seed)), desc="Generating samples"):
for i in range(n_sample):
#check if the sample is controlled by a seed
if i < args.n_save_sample:
if args.model_variant == 'inpainting':
Expand Down Expand Up @@ -1201,6 +1205,7 @@ def save_and_sample_weights(step,context='checkpoint',save_model=True):
images[0].save(os.path.join(sample_dir,sampleName, f"{sampleName}_controlled_seed_{str(seed)}.png"))
else:
images[0].save(os.path.join(sample_dir, f"{sampleName}_controlled_seed_{str(seed)}.png"))
progress_bar_sample.update(1)

if args.send_telegram_updates:
imgs = []
Expand Down