Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate samples together with the dataset. #1383

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

gesen2egee
Copy link
Contributor

@gesen2egee gesen2egee commented Jun 24, 2024

If your sample's prompt includes __caption__, it will select an example from the batch (preferring those without caption dropout).
It then combines the latent and caption from batch to produce a sample, caption is displayed at the top.
Each occurrence of __caption__ generates once, and can be combined with the original sample args.

image
image

@kohya-ss
Copy link
Owner

Thank you for this! This is very interesting. I will review this sooner.

I am just concerned about how it works with non-Windows systems. It might be better to use default font instead of arial.ttf.

@araleza
Copy link

araleza commented Jun 26, 2024

This sounds good. I had to write a python script that repeatedly overwrites sample.txt with random captions to achieve this, but it would be nicer if it was integrated into sd-scripts itself.

idx = (idx + 1) % len(example_tuple[1])
if idx == 0:
break
prompt_dict["prompt"] = prompt_dict.get("prompt").replace('__caption__', 'example_tuple[1][idx]')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be:
prompt_dict["prompt"] = prompt_dict.get("prompt").replace('__caption__', example_tuple[1][idx])?

Current behavior replacing with the string 'example_tuple[1][idx]' instead of the value of the tuple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants