Skip to content

Conditional skip #18

Open
Open
@valconius

Description

@valconius

Around line 168 under the file in scripts/, an error is raised if prompt replace did not replace something.

if Script.VALIDATE_REPLACE and match not in p.prompt and match not in p.negative_prompt:
        raise RuntimeError(f"Invalid prompt replace, '{match}' is not in prompt '{p.prompt}' nor negative prompt '{p.negative_prompt}'")

It is convenient, as mentioned in other issues here and there, to have a dreambooth model specify its trained activation string with a prompt replace. If a placeholder string is "style" and the activation string is "drawing" but we have an axis that instead uses "painting" and "watercolor", then presently I have two placeholder strings "style_dreambooth" and "style_other" and perform prompt replace twice in each value of the axis. (This means non-dreambooth's results have a dummy "style_dreambooth" string left over.)

To decrease the number of images generated, an axis could perhaps skip generating some value when its prompt replace fails, assuming the dreambooth's axis already replaced "style_other" with an empty string.

However, more in line with the spirit of this extension, the regular style prompt replace can be left alone. In this case, the style axis should delete the "style_dreambooth" string only if it exists. If the dreambooth model already replaced that string, then the error should not be raised.

So this weird hack could be used to make better grids in the later case, but it would also permit fractionally decreasing the dimensions of a grid by saying, "we have many axes including 3 models and 2 styles, don't make images only for styles when the single dreambooth model is selected".

I don't know how to reference other github issues, but the former case is like having the model axis' dreambooth value set a variable, "don't define a style because I already set it," and then having the prompt replace that occur later on either not generate an image under this condition or else perform an alternative prompt replace under this condition, but now this is starting to resemble things expected of a full programming language and goes beyond the confines of yaml or the prompt replace mini-dsl where you merely separate params with an equals sign.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureSomething new to add.Low PriorityThis issue is not likely to be officially addressed anytime soon, but open for PRs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions