Giter Club home page Giter Club logo

Comments (9)

adieyal avatar adieyal commented on August 11, 2024 1

I know this is an old issue, but you might be interested in looking into the new parser in 1.5.0. It adds support for many requested features which may be useful. Note, the prompt parser has been completely re-written and so there may be a few teething problems

from sd-dynamic-prompts.

adieyal avatar adieyal commented on August 11, 2024

We will need a different syntax, {{2-3$$X|Y|Z} is for variations whereas __artist__ is for wildcards. Maybe something like __artist(2-3)__ or similar?

from sd-dynamic-prompts.

galvanized avatar galvanized commented on August 11, 2024

There's a few different things to consider here.

  • Multiple samples from a single wildcard: "between 2 and 3 samples from __artist__".
  • Multiple samples from the union of multiple wildcards: "2 samples from a list combining __artist__ and __movement__".

It may also be the case that the user wants to combine variations and multiple samples.

  • Combination of wildcards, where each wildcard can have multiple samples. "Use up to 2 wildcards, where there can be up to 3 artists, between 1 and 5 movements, and up to 2 types of lighting".
  • Combination of wildcards and literals, where each wildcard can have multiple samples. "Use either 1-3 artists or the word 'vibrant'."

I think that * is a reasonable character to mean repeating something, but I'm not sure what kind of syntax should join multiple wildcards into a "superwildcard". | is used to join sets in Python but it's already taken by variations. Maybe &?

I'm not a big fan of __artist(2-3)__ for multiple wildcard samples. I think keeping __artist__ intact is cleaner and treats the wildcard name as its own unit, and parenthesis are being used by the automatic1111 webui for prompt weighting. (I know that Dynamic Prompts will filter them out, but the symbol is still overloaded and may be confusing for the user, especially when there's a lot of parenthesis already present.) Plus it's not clear how it would consider "superwildcards".

One proposal:
__artist__&__movement__ creates a "superwildcard" which can then be sampled like one wildcard, but is the union of both wildcards.
{__artist__*2-4} means "use between 2 and 4 artists".
{__artists__&__movement__*2} means "use either two artists, two movements, or one of each".
{2$$__artists__&__movement__*2|__colors__*0-3|vivid} means to use two from this list:

  • 2 elements from the union of artists and movements
  • up to 3 colors
  • the word "vivid"

Not entirely set on this syntax but I think an alternative should support the same functionality.

On another note: should multiple samples be with or without replacement? That is, should it be possible for there to be duplicates? I'm thinking no duplicates (sample without replacement). If there's a reason you could want duplicates there may need to be syntax to support it.

from sd-dynamic-prompts.

DominoMarama avatar DominoMarama commented on August 11, 2024

I don't mind duplicates, it just acts as emphasis on a particular choice. Given the number of wildcards, they tend to be rare anyway. Probably better to limit them though as {__artist__*2}{0-2$$__artist__*2} could still be used to deliberately give a chance of duplicates.

With my original syntax, I was assuming it could be done by changing the processing order so wildcards are expanded after picking the list items to be used.

{2-3$$__artist__}

So basically pick 2-3 items from the list ["__artist__"] giving either ["__artist__", "__artist__"] or ["__artist__","__artist__","__artist__"] as the list to send for wildcard expansion.

{2$$__a__|__m__|bob ross}

Pick 2 random items from ["__a__", "__m__", "bob ross"] giving one of the various combinations such as ["__m__", "__m__"] or ["bob ross", "__a__"] to send to wildcard expansion (where deduping could be done if desired during the list expansion).

from sd-dynamic-prompts.

adieyal avatar adieyal commented on August 11, 2024

I'm happy to explore more extensive syntax but I wonder whether we can get far with what we already have plus a minor tweak. Currently this doesn't make sense {2$$__wildcard__} since there aren't two variants to choose from. If we simply remove the restriction that variants chosen should be unique, then {2$$__wildcard__} would be equivalent to {2$$wildcard|__wildcard}.

With regard to concatenating two lists, {__wildcard1__|__wildcard2__} effectively does that.
{2$$__wildcard1__|__wildcard2__} will give you 2 from wildcard1, two from wildcard2, or one from each.

Not explicitly including a concatenation operator means that {__wildcard1__ & __wildcard2__|__wildcard3__} is not possible (I'm using & as an example syntax). Is that a real use case? If we really want to add it, something like this would make sense {__wildcard1__ __wildcard2__|__wildcard3__} , that's the same syntax that you would expect on the command line when globbing multiple file patterns.

Thoughts?

from sd-dynamic-prompts.

DominoMarama avatar DominoMarama commented on August 11, 2024

Will the unique variant restriction still apply to text? The more I thought about it, it seemed a big expectation to break now people are used to it. Is postponing the unique check for wildcards until their expansion an option?

from sd-dynamic-prompts.

adieyal avatar adieyal commented on August 11, 2024

Do you mean sampling without replacement, i.e. {2$$__wildcard__} returning unique valuees? I think this is an edge case.

If __wildcard__ is large, then the likelihood of it happening is low. If __wildcard__ is tiny, e.g. one value in the file, then it will be impossible to return more than one. In any case, if it's not unique, and you don't like it, simply regenerating will give you a different combination.

from sd-dynamic-prompts.

DominoMarama avatar DominoMarama commented on August 11, 2024

I was thinking of mixed cases like {2$$__a__|__b__|Bob Ross|{2$$__a__}} where it'd be better to avoid two Bob Rosses coming up too often in large batches. Only allowing duplicate __wildcard__ and {prompt} tokens and not duplicate text seems useful there. A duplicate Bob Ross coming from one of the wildcard files is acceptable and avoids potential endless loops if all wildcards in a short file are used in a prompt.

from sd-dynamic-prompts.

adieyal avatar adieyal commented on August 11, 2024

Marginally related to this discussion, you might be interested in having a look at the jinja2 templates mechanism for more advanced prompt generation: https://github.com/adieyal/sd-dynamic-prompts#jinja2-templates

from sd-dynamic-prompts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.