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

a new approach conditioning prompts (personalized.py) #30

Open
ciaobnsr opened this issue Sep 20, 2022 · 1 comment
Open

a new approach conditioning prompts (personalized.py) #30

ciaobnsr opened this issue Sep 20, 2022 · 1 comment

Comments

@ciaobnsr
Copy link

in the personalized.py when it comes to use prompts for conditioning i've seen a new approach that works per-image.
ive seen it used on the original rinongal so your code might be different:

"If you want to change your training to be done on sample image specific prompts rather than random prompts like "a photo of *", then in personalized.py you can just change
text = random.choice(imagenet_templates_small).format( placeholder_string )
to
imgName = Path(imgPath).stem # filename without directories or extension
text = imgName.replace("@", "{}" ).format( placeholder_string ) # could maybe just be .replace("@", placeholder_string)

And write your prompt in your training image filenames with @ for the embedding (e.g. a closeup portrait photo of @ from the left, against a beige background.png). It seems to help generate an embedding which also has to work with other parts of the prompt, rather than just training an embedding for a physical object which isn't much influenced by the prompt"

is there a way to make this approach work with this repo, and if yes will it really help to achieve a better result? (im guessing it would find identity faster and keep a better editability but it's just guesses)

@CodeExplode
Copy link

Heya just a slight update since I wrote this code in discord, the second line can just be:

text = text.replace("@", placeholder_string )

I'm not entirely sure whether it's helping or not. My idea is that it requires the embedding to also work in the context of the other prompt words, which hopefully maintains more editability. With just the embedding by itself as the prompt you may get decent results much faster, but it's an embedding which perhaps doesn't consider (or activate weights which interact with) other words around it, and acts more like a static object model.

@ciaobnsr ciaobnsr changed the title a new approach to conditioning prompts (personalized.py) a new approach conditioning prompts (personalized.py) Sep 20, 2022
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

No branches or pull requests

2 participants