diff --git a/README.md b/README.md index 22ba13d..77052be 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,6 @@ The dynamic prompts library powers the [Dynamic Prompts](https://github.com/adie * [Wildcard Collections](#wildcard-collections) * [Dynamic Prompts in the wild.](#dynamic-prompts-in-the-wild) - - - ## Quick overview of the templating language: ### Variants @@ -165,7 +162,7 @@ Funko pop __celebrities__ figurine, made of __material__, __studio-shot__ Hat tip to [publicprompts](https://publicprompts.art/) for the funko pop prompt. -The complete syntax can be found [here](https://github.com/adieyal/sd-dynamic-prompts/blob/main/docs/SYNTAX.md). +The complete syntax can be found [here](docs/SYNTAX.md). ## Installation @@ -421,7 +418,7 @@ generator.generate(template) ## Template syntax -You can find the complete syntax guide [here](https://github.com/adieyal/sd-dynamic-prompts/blob/main/docs/SYNTAX.md) +You can find the complete syntax guide [here](docs/SYNTAX.md) ### Syntax customisation To address potential syntax clashes with other tools it is possible to change various tokens. Instead of `{red|green|blue}` you can configure the library to use the `<` `>` pair instead, e.g. ``. You can also change the `__` used in wildcards. So instead of `__colours__`, you can configure wildcards to use `**`, e.g. `**colours**` diff --git a/docs/SYNTAX.md b/docs/SYNTAX.md new file mode 100644 index 0000000..4d74cbe --- /dev/null +++ b/docs/SYNTAX.md @@ -0,0 +1,603 @@ +# Syntax Guide + +This guide will walk you through the template language used to generate dynamic prompts. It covers various features such as variants, wildcards, variables, and parameterized templates. + +## Table of contents + * [Variants](#variants) + * [Basic Syntax](#basic-syntax) + * [Weighting Options](#weighting-options) + * [Choosing Multiple Values](#choosing-multiple-values) + * [Custom Separator](#custom-separator) + * [Range of Options](#range-of-options) + * [Omitting Bounds](#omitting-bounds) + * [Limitations](#limitations) + * [Wildcards](#wildcards) + * [Basic Syntax](#basic-syntax-1) + * [Wildcards in Variants](#wildcards-in-variants) + * [Variants in Wildcards](#variants-in-wildcards) + * [Nested Wildcards](#nested-wildcards) + * [Resolving Wildcards with Globbing](#resolving-wildcards-with-globbing) + * [Basic Syntax](#basic-syntax-2) + * [Example](#example) + * [File formats](#file-formats) + * [Text files](#text-files) + * [YAML files](#yaml-files) + * [JSON files](#json-files) + * [Variables](#variables) + * [Immediate Evaluation](#immediate-evaluation) + * [Non-immediate Evaluation](#non-immediate-evaluation) + * [Parameterized Templates](#parameterized-templates) + * [Basic Syntax](#basic-syntax-3) + * [Default values](#default-values) + * [Whitespace and comments](#whitespace-and-comments) + * [Samplers](#samplers) + + +## Variants + +Variants allow you to randomly generate one or more options from a list of possibilities. They can be weighted, and you can control the number of options to be chosen. + +### Basic Syntax + +To create a variant, wrap your options in curly brackets {} and separate them with a vertical bar |. For example: + +``` +{summer|autumn|winter|spring} is coming +``` + +This will randomly generate one of the following: + +* summer is coming +* autumn is coming +* winter is coming +* spring is coming + +### Weighting Options + +You can add weights to options to control their relative frequency. To do this, add a double colon `::` followed by the weight before the option: + +``` +`{0.5::summer|0.1::autumn|0.3::winter|0.1::spring}` +``` + +The weights are relative and do not have to add up to 1. +If you omit a weight, it is assumed to be 1. +Weights are also possible in YAML wildcard files, [see below](#weighted-options-in-yaml). + +### Choosing Multiple Values + +To choose multiple values, add a number followed by double dollar signs `$$` before your options: + +``` +My favourite ice-cream flavours are {2$$chocolate|vanilla|strawberry} +``` + +This will generate one of the following: + +* My favourite ice-cream flavours are chocolate, vanilla +* My favourite ice-cream flavours are chocolate, strawberry +* My favourite ice-cream flavours are vanilla, chocolate +* ... +etc + +Values are chosen without replacement, so you won't get repeats. + +### Custom Separator + +You can change the default separator by adding a custom separator between the double dollar signs: + +``` +My favourite ice-cream flavours are {2$$ and $$chocolate|vanilla|strawberry} +``` + +This will generate one of the following: + +* My favourite ice-cream flavours are chocolate and vanilla +* My favourite ice-cream flavours are chocolate and strawberry +* My favourite ice-cream flavours are vanilla and chocolate +* ... + +### Range of Options + +To provide a range for the number of options to be chosen, use a dash `-` between the lower and upper bounds: + +``` +My favourite ice-cream flavours are {1-2$$ and $$chocolate|vanilla|strawberry} +``` + +This will generate: + +* My favourite ice-cream flavours are chocolate +* My favourite ice-cream flavours are strawberry +* My favourite ice-cream flavours are vanilla +* My favourite ice-cream flavours are chocolate and vanilla +* My favourite ice-cream flavours are chocolate and strawberry +* My favourite ice-cream flavours are vanilla and chocolate +* ... + +#### Omitting Bounds + +You can omit the lower or upper bound, and it will be treated as the minimum or maximum possible value: + +``` +{-2$$chocolate|vanilla|strawberry} == {1-2$$chocolate|vanilla|strawberry} +{1-$$chocolate|vanilla|strawberry} == {1-2$$chocolate|vanilla|strawberry} +``` + +#### Limitations + +If you request more options than values in the variant, you will only get as many items as are available: + +``` +p{4$$chocolate|vanilla|strawberry} == chocolate, vanilla, strawberry +``` + +## Wildcards + +### Basic Syntax + +Wildcards are placeholders that inject values from a file into your prompt. +Create a file with the desired values and use double underscores `__` to indicate the wildcard: + +``` +__season__ is coming +``` + +Assuming you have a seasons.txt file with the following content: + +``` +# seasons.txt +summer +autumn +winter +spring +``` + +This prompt will randomly generate one of the following: + +* summer is coming +* autumn is coming +* winter is coming +* spring is coming + +### Wildcards in Variants + +You can choose multiple values from a wildcard as follows: + +``` +My favourite ice-cream flavours are {2$$__flavours__} +``` + +This syntax is also possible: + +``` +My favourite ice-cream flavours are {2$$__flavours__|__flavours__} +``` + +but the first version will guarantee no duplicates. + +### Variants in Wildcards + +Wildcard values can also contain variants. For example, if your seasons.txt file contains: + +``` +# seasons.txt +summer +{autumn|fall} +winter +spring +``` + +The possible outputs are: + +* summer is coming +* autumn is coming +* fall is coming +* winter is coming +* spring is coming + +### Nested Wildcards + +You can use wildcards inside other wildcards. If you have a file called people_of_the_world.txt containing: + +``` +# people_of_the_world.txt +__asia__ +__africa__ +__europe__ +__north_america__ +__south_america__ +__australisia__ +... +``` + +And another file called africa.txt containing: + +``` +# africa.txt +Zimbabwean +Namibian +Basotho +... +``` + +Then + +``` +__people_of_the_world__ +``` + +will first select a value in people_of_the_world.txt. If that value is a wildcard, say `__africa__`, +it will then choose a value from within `africa.txt. Using nesting, you can create an sophisticated wildcard hierarchies. + +### Resolving Wildcards with Globbing + +Globbing allows you to match multiple wildcard files at once. +This can be useful if you have multiple files that contain similar data and want to use values from all of them in your prompts. + +For example, if you have two files, colours-cold.txt and colours-warm.txt, +you can use globbing to resolve values from both of these files by using an asterisk `*` as a wildcard. + +#### Basic Syntax + +To use globbing, simply include an asterisk `*` in your wildcard pattern: + +``` +__colours*__ +``` + +In this example, any file that starts with colours will be matched. So both colours-cold.txt and colours-warm.txt will be used to resolve values. + +#### Example + +Suppose you have the following files: + +colours-cold.txt: + +``` +# colours-cold.txt +blue +green +``` + +colours-warm.txt: + +``` +# colours-warm.txt: +red +yellow +``` + +Using the `__colours*__` wildcard will randomly select a value from both files: + +``` +The colour of my shirt is __colours*__ +``` + +Possible outputs are: + +* The colour of my shirt is blue +* The colour of my shirt is green +* The colour of my shirt is red +* The colour of my shirt is yellow + +#### Recursive globbing + +You can use two wildcards, e.g. `artists/**` to match any wildcard in the `artists/` hierarchy, no matter how deeply nested. + +### File formats + +#### Text files + +The basic wildcard file is a simple text file with a `.txt` extension. It has one value per line. You can comment out a line with a `#`, e.g. + +``` +# this is a comment +summer +autumn +winter +spring +``` + +#### YAML files + +YAML files are supported for storing a hierarchy of prompts. Here is an example: + +``` +# example.yaml +clothing: + - T-shirt + - Pants + - Shoes +artists: + finnish: + - Akseli Gallen-Kallela + - Eero Järnefelt + - Helene Schjerfbeck + dutch: + - Piet Mondrian + - Rembrandt van Rijn + - Vincent van Gogh + 1234: 5678 # this is ignored + flurp: 12345 # this too +``` + +The last two entries are ignore since they don't store arrays. + +##### Weighted options in YAML + +A handy feature of YAML files is that they provide an easy way to add weights to wildcards, something which isn't possible using standard text files. Here is an example: + +```yaml +{ + 2::red + | 3::blue + | 1:: green +} +``` + +#### JSON files + +Similar to YAML, you can use JSON files as well: + +``` +{ + "clothing": [ + "T-shirt", + "Pants", + "Shoes" + ], + "artists": { + "finnish": [ + "Akseli Gallen-Kallela", + "Eero Järnefelt", + "Helene Schjerfbeck" + ], + "dutch": [ + "Piet Mondrian", + "Rembrandt van Rijn", + "Vincent van Gogh' + ] + } +} +``` + +## Variables + +Variables allow you to store and reuse values in your prompts. To set a variable, use the following syntax: + +``` +${variable_name=value} +``` + +### Immediate Evaluation + +To force the immediate evaluation of a variable's value, add an exclamation mark ! before the value: + +``` +${season=!__season__} +``` + +or + +``` +${season=!{summer|autumn|winter|spring}} +``` + +You can then use the variable in your prompt: + +``` +In ${season}, I wear ${season} shirts and ${season} trousers +``` + +This will generate: + +* In summer, I wear summer shirts and summer trousers +* In autumn, I wear autumn shirts and autumn trousers +* In winter, I wear winter shirts and winter trousers +* In spring, I wear spring shirts and spring trousers + + +### Non-immediate Evaluation + +Without the exclamation mark, the wildcard or variant will be evaluated every time it is used: + +``` +${season=__season__} and In ${season}, I wear ${season} shirts and ${season} trousers +``` + +This may produce: + +In summer, I wear winter shirts and autumn trousers. Non-immediate evaluation is useful in the case that don't want to define a complex construct multiple times in the same prompt. e.g. + +Instead of: + +``` +A {blond|redhead|brunette}, {green|blue|brown|hazel} eyes, {tall|average|short} man and a {blond|redhead|brunette}, {green|blue|brown|hazel} eyes, {tall|average|short} woman +``` + +you can use a variable instead: + +``` +${person_description={blond|redhead|brunette}, {green|blue|brown|hazel} eyes, {tall|average|short}} +A ${person_description} man and a ${person_description} woman +``` + +## Parameterized Templates + +You can pass values into wildcard templates to create more dynamic prompts. + +### Basic Syntax + +Create a file called `season_clothes.txt` with the following content: + +``` +In ${season}, I wear ${season} shirts and ${season} trousers +``` + +Then, in your prompt, you can pass a value to the template: + +``` +__season_clothes(season=winter)__ +``` + +Note - for now you can only pass a literal string into the template rather than an expression. This syntax will also work + +``` +${season={summer|autumn|winter|spring} __season_clothes__ +``` + +### Default values + +A template will throw an error if it expects a variable that isn't set. To prevent this from happening you can set a default value. + +``` +In ${season:summer}, I wear ${season:summer} shirts and ${season:summer} trousers +``` + +Now if you forget to create the season variable, the prompt will be `In summer, I wear summer shirts and summer trousers` + +## Whitespace and comments + +As your prompts become more complex, the become harder to read. To prevent creating unreadable and unmaintainable prompts you can use whitespace such as newlines, which will be ignored by the parser. Python-style comments are also supported so that you can annotate your prompt. + +``` + # Set the season variable + ${season={ + summer + |autumn + # | fall # commented this value out + |winter + |spring + } + + In ${season:summer}, I wear ${season:summer} shirts and ${season:summer} trousers +``` + +Note that regular wildcard .txt files use a newline to represent new wildcard and so whitespace is not permitted. In this case you should consider using the YAML wildcard format. Here is a real-world example from the [publicprompts](https://github.com/adieyal/sd-dynamic-prompts/blob/main/collections/publicprompts.yaml) wildcard file: + +``` +# publicprompts.yaml +# Prompts taken https://publicprompts.art/ +public-prompts: + cute-stuffed-animals: + - | + # Usage: __public-prompts/cuddly-toys(figure=elephant)__ + # Homepage: https://publicprompts.art/cute-stuffed-animals/ + # Suggested settings: + # CFG scale: 13 + # Sampler DDIM + # Steps: 35 + + cute kawaii Squishy ${figure} plush toy, + realistic texture, visible stitch line, + soft smooth lighting, + vibrant studio lighting, + modular constructivism, + physically based rendering, + square image +``` + +## Samplers + +Samplers are an advanced topic although understanding how they work will help you understand how the dynamic prompts engine works. +Dynamic Prompts uses samplers to select values from variants and wildcards. +So far, we have assumed a random sampler, which randomly selects one of the options. +However, combinatorial and cycle samplers are also available, offering different sampling behaviours. + +Let's see how the different samplers behave using this prompt: + +``` +A {red|green|blue} {square|circle} +``` + +### Random Sampler + +The random sampler picks values randomly from both variants: + +``` +A green circle +A blue square +A blue circle +... +``` + +### Combinatorial Sampler + +The combinatorial sampler produces all possible combinations: + +``` +A red square +A red circle +A green square +A green circle +A blue square +A blue circle +``` + +### Cyclical Sampler + +The cyclical sampler cycles through values and produced this repeating pattern of prompts + +``` +A red square +A green circle +A blue square +A red circle +... +``` + +To use the combinatorial sampler, you need to use a [CombinatorialPromptGenerator](https://github.com/adieyal/dynamicprompts#combinatorial-generation) if you're using the [dynamicprompts](https://github.com/adieyal/dynamicprompts) library directly or the [combinatorial mode](https://github.com/adieyal/sd-dynamic-prompts#combinatorial-generation) if you are using the extension. You can also explicitly specify which sampler to use for certain parts of your prompt. + +The `~` is used for a random sampler and `@` for cyclical. The syntax for variants is `{~red|green|blue}` and `__~colours__` for wildcards. Similarly, `{@red|green|blue}` and `__@colours__` for cycle. + +If a sampler is not explicitly specified, the default sampler is used, the value of which depends on your generator. + +Example using a random sampler and explicitly setting the second variant to use a cyclical sampler: + +``` +{red|green|blue} {@square|circle} +``` + +The first variant is sampled randomly, but the second one uses the cyclical sampler, example outputs: + +``` +blue square +red circle +red square +green circle +... +``` + +If using the combinatorial sampler and explicitly setting the second variant to use a random sampler: + +``` +{red|green|blue} {~square|circle} +``` + +The first variant is sampled using a combinatorial sampler, the second is randomly sampled. Example outputs: + +``` +red circle +green circle +blue square +``` + +Note that it only produces 3 outputs and then stops. That's because the combinatorial sampler is finite, and there are a finite number of combinations, in this case red, green, and blue. + +Random and cyclical samplers are non-finite, meaning you can continually ask them for more values, eventually leading to duplicates. + +Cyclical samplers are useful if you want to keep two values in sync, e.g., embeddings: + +``` +{@embedding1|embedding2} and {@embedding3|embedding4} +``` + +This will keep embedding1 and embedding3 together, and embedding2 and embedding4 together, i.e.: + +``` +embedding1 and embedding3 +embedding2 and embedding4 +embedding1 and embedding3 +... +``` diff --git a/docs/tutorial.md b/docs/tutorial.md index 726a3fe..5a84afa 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,16 +1,23 @@ -Constructing good prompts for Stable Diffusion can be difficult, especially if you're trying to learn through trial and error. Dynamic Prompts is an extension for Automatic1111's webui that let's you test dozens or hundreds of prompts at the same time by making tweaks to your base prompt. +# Introduction + +Constructing good prompts for Stable Diffusion can be difficult, especially if you're trying to learn through trial and error. Let's see how this works. -Suppose you want to create images of a diamond ring, you might start with something like: +## Getting Started + +Suppose you want to create images of a diamond ring; you might start with something like: + + A diamond ring on a gold band. - A diamond ring set on a gold band. +## Variants -What if we wanted an image of a platinum ring as well? We can using Dynamic Prompts variant syntax, e.g. +What if we wanted an image of a platinum ring as well? We can use the Dynamic Prompts variant syntax, e.g. A diamond ring set on a {gold|platinum} band. -If we enter this into the prompts box with Dynamic Prompts installed, the generated prompt would be one of: +Dynamic Prompts would then generate one of: + A diamond ring set on a gold band @@ -18,25 +25,29 @@ and A diamond ring set on a platinum band +## Nested variant + Gold comes in various varieties, let's add those as well: A diamond ring set on a {{rose|yellow|white} gold|platinum} band. -Notice how we nested a variant for the type of gold, i.e. `{rose|yellow|white}` inside the main variant. So now, when generating an image, one of the following prompts is created: + +Notice how we nested a variant for the type of gold, i.e. `{rose|yellow|white}` inside the main variant. +So now, when generating an image, one of the following prompts is created: A diamond ring set on a rose gold band A diamond ring set on a yellow gold band - A diamond ring set on a whilte gold band + A diamond ring set on a white gold band A diamond ring set on a platinum band -Nesting variants can quickly make your prompt template hard to read. Luckily, Dymamic Prompts ignores whitespace so that we can change the prompt to: +Nesting variants can quickly make your prompt template hard to read. Luckily, Dynamic Prompts ignores whitespace so that we can change the prompt to: A diamond ring set on a { {rose|yellow|white} gold # you can also add comments | platinum # which will be ignored by the DP parser } band -Of course, we're not limited to only one variant, we can add a little more variation like this: +Of course, we're not limited to only one variant; we can add a little more variation like this: A {diamond|ruby|emerald} ring set on a {classic|thin|thick} { @@ -51,7 +62,8 @@ This template could produce any of these prompts: A emerald ring set on a thin platinum band etc. -That second prompt isn't grammatically correct, it doesn't really matter to Stable Diffusion, but if you prefer correct English, you can write something like: + +That second prompt isn't grammatically correct, it doesn't matter to Stable Diffusion, but if you prefer correct grammar, you can write something like: {A diamond|A ruby|An emerald} ring set on a {classic|thin|thick} { @@ -60,17 +72,17 @@ That second prompt isn't grammatically correct, it doesn't really matter to Stab } band -Notice that we added a variant to the type of stone. Now we are creating, diamond, emerald and ruby rings. What if we had a large number of gems that we would like to use in our rings? You can certainly add them as variants, but this may become cumbersome with a large number of variants. In this case we can use a wildcard. +## Wildcards +What if we had many gems that we would like to use in our rings? You can certainly add them as variants along with rubies and emeralds, but this may become cumbersome with many variants. In this case, we can use a wildcard. -First, we create a file called gems.txt -In it we add one variant per line, e.g. +First, we create a file called `gems.txt` inside the wildcards folder. The location depends on the frontend you're using for Dynamic Prompts. +In it, we add one variant per line, e.g. +``` diamond ruby emerald -... - -We place this file inside the extension's wildcard folder. This can be found in extensions/sd-dynamic-prompts/wildcards +``` Now our prompt changes to: @@ -81,94 +93,150 @@ Now our prompt changes to: } band -`__gems__` is a wildcard and will act as a variant the uses every gem in gems.txt. Note, the name of the wildcard is the same as the name of the file, i.e. gems.txt without the .txt at the end. We then add a double underscore `__` to the beginning and end of the wildcard. Neat! +`__gems__` is a wildcard and will act as a variant that uses every gem in gems.txt. Note the name of the wildcard is the same as the name of the file, i.e., gems.txt without the .txt at the end. We then add a double underscore `__` to the beginning and end of the wildcard. -Wildcard files can use all the same syntax that we can use in our prompts. To demonstrate this, let's create a new file called precious_metals.txt. Inside we add: +Neat! +Wildcard files can use all the same syntax that we can use in our prompts. To demonstrate this, let's create a new file called `precious_metals.txt`. Inside we add: + +``` {rose|yellow|white} gold platinum silver +``` Move the file into the wildcards folder. Now our prompt looks like this: - A __gems__ ring set on a {classic|thin|thick} __previous_metals__ band + A __gems__ ring set on a {classic|thin|thick} __precious_metals__ band + +## Combinatorial Generation -We can now generate a large number of different rings. Let's create 10 images. Set the batch count to 10 and click generate. This is what we get. +By default, Dynamic Prompts generates random prompts from our template. Each prompt will choose a random gem, random band type, and random precious metal. Let's count the total number of possible rings our template can generate: -Note, Dynamic Prompts generates random prompts that conform with our template. Let's count the total number of possible rings our template can generate: + Assume we have ten different types of gems in our gems.txt file + Three band thicknesses + Three metals, although gold has three variants, so we actually have five metals. - The gems file has 10 gems - 3 band thicknesses - 3 metals, although gold has 3 variants so we actually have 5 metals. + The total number of potential prompts is 10 * 3 * 5 = 150 different prompts. - The total number of potential prompts is 10 * 3 * 3 = 90 different prompts. +What if we wanted to generate all of them? In that case, we change to combinatorial mode. -What if we wanted to generate all of them? In that case we change to combinatorial mode. In combinatorial mode, batch count is interpreted differently. In random mode, batch count represented the total number of prompts to generate, in combinatorial mode, it means AT MOST 10 prompts. If our template was simply A diamond ring set on a {gold|platinum} band, then regardless of what we set batch count to, Dynamic Prompts will only generate two prompts. On the other hand if your gems.txt and precious_metals.txt files were very long, say 50 gems and 20 metals, you could then generate 1000 differnt prompts. The reason for setting the upper bound is to prevent accidentally generating far more prompts than you expect. +## Wildcard Collection -== Wildcards == -A well-designed wildcard library can be used as building blocks for creating great prompts, without having to reinvent the wheel everytime. Dynamic Prompts provides a large collection of wildcards that you can either use wholesale, or pick and choose files that you're interested in. You can see these collections in the Wildcards Manager tab. +A well-designed wildcard collection can be used as building blocks for creating great prompts without having to reinvent the wheel every time. -The most interesting wildcards are those related to art and artists. It's a great way to explore different styles. In particular, you can choose multiple artists to influence the final output. So you can write a prompt like: +The most interesting wildcards are those related to art and artists. It's a great way to explore different styles. - A mech-warrior in a post-apocalytic setting by artist1 and artist2. +If you like to experiment with styles from multiple artists at the same time, try something like: -This is where a wildcard library comes in very handy. Try this prompt: + surfer in space, intricate detail, airbrush painting, illustration, by __artists/European Art/modern/pointilism__ and __artists/European Art/modern/american_impressionism__ - A mech-warrior in a post-apocalyptic settings by __artists__ and __artists__ +Here are some prompts that I get using the default collections available in the `sd-dynamic-prompts` extension: -Here are some prompts that I get: - A mech-warrior in a post-apocalyptic settings by __artists__ and __artists__ - A mech-warrior in a post-apocalyptic settings by __artists__ and __artists__ - A mech-warrior in a post-apocalyptic settings by __artists__ and __artists__ + surfer in space, intricate detail, airbrush painting, illustration, by Vincent van Gogh and Daniel Garber -Dynamic Prompts has syntax to simplify this. Two automatically choose two artists, we use the variant syntax but prepend it with a `2$$`. Instead of a variant, this is a combination and look like this: + surfer in space, intricate detail, airbrush painting, illustration, by Maximilien Luce and Wilson Irvine - A mech-warrior in a post-apocalyptic settings by {2$$__artists__} + surfer in space, intricate detail, airbrush painting, illustration, by Jean Metzinger and John Elwood Bundy -That will produce: +Dynamic Prompts has syntax to allow you to choose two artists together: + + surfer in space, intricate detail, airbrush painting, illustration, by {2$$__artists/illustrations/childrens_books__} + +Some examples of prompts that are generated: + + surfer in space, intricate detail, airbrush painting, illustration, by Todor Dinov,Ray Goossens + + surfer in space, intricate detail, airbrush painting, illustration, by Emily Winfield Martin,Kitty Crowther + + surfer in space, intricate detail, airbrush painting, illustration, by Fritz Wegner,Dawu Yu - A mech-warrior in a post-apocalyptic settings by __artists__,__artists__ - A mech-warrior in a post-apocalyptic settings by __artists__,__artists__ - A mech-warrior in a post-apocalyptic settings by __artists__,__artists__ The default separator is a `,` - if you prefer to use `and` then change the prompt like this: - A mech-warrior in a post-apocalyptic settings by {2$$ and $$__artists__} + surfer in space, intricate detail, airbrush painting, illustration, by {2$$ and $$__artists/illustrations/childrens_books__} -note the spaces surrounding the `and`. If you don't add them then your combination might look like: +Note the spaces surrounding the `and`. +If you don't add them then your combination might look like: -A mech-warrior in a post-apocalyptic settings by artist1andartist2 + A mech-warrior in a post-apocalyptic settings by artist1andartist2 -You don't need to stop at 2, combination syntax allows you to choose any number of artists. For four artists you write it like this: +You don't need to stop at 2; the combination syntax allows you to choose any number of artists. For four artists, you write it like this: - A mech-warrior in a post-apocalyptic settings by {4$$__artists__} + surfer in space, intricate detail, airbrush painting, illustration, by {4$$__artists/illustrations/childrens_books__} You can provide a range, e.g. - A mech-warrior in a post-apocalyptic settings by {2-4$$__artists__} + surfer in space, intricate detail, airbrush painting, illustration, by {2-4$$__artists/illustrations/childrens_books__} Here dynamic prompts will choose 2, 3, or 4 artists. -Magic Prompts -============= +# Tools for inspiration -When you look at prompts that people post online, you will often notice a number of modifiers related to lighting, resolution, camera type etc. When you're starting out, you might feel overwhelmed by these modifiers. The magic prompt functionality is a fun way to automatically add modifiers to your prompt. You can experiment, but a good way to start is to use a very simple prompt, e.g. +## Magic Prompts - A mech-warriour in a post-apocalyptic setting. +When you look at prompts that people post online, you will often notice several modifiers related to lighting, resolution, camera type etc. +When you're starting out, you might feel overwhelmed by these modifiers. +The magic prompt functionality is a fun way to add modifiers to your prompt automatically. +You can experiment, but a good way to start is to use a simple prompt, e.g. -Enable Magic Prompt and click generate. (Note, Magic Prompt uses a neural network add these based on context. The first time you use it, Dynamic Prompts will need to download it which may take some time depending on the speed of your Internet connection.) + A mech-warrior in a post-apocalyptic setting. + +These images are a little plain. Let's jazz them up with Magic Prompts. +Enable Magic Prompt and click generate. (Note, Magic Prompt uses a neural network to add these based on context. +The first time you use it, Dynamic Prompts will need to download it, which may take some time depending on the speed of your Internet connection.) Here are some example prompts that I get when using Magic Prompt: -A mech-warrior in a post-apocalyptic settings by {2$$__artists__} -A mech-warrior in a post-apocalyptic settings by {2$$__artists__} -A mech-warrior in a post-apocalyptic settings by {2$$__artists__} + A mech-warrior in a post-apocalyptic setting. Digital illustration, Artstation. 8k resolution, Concept art, Detailed digital art + + A mech-warrior in a post-apocalyptic setting. Detailed digital art by greg rutkowski, Thomas kinkade, Keith Parkinson, artstation, cgsociety, deviantart, 8k, HD + + A mech-warrior in a post-apocalyptic setting. realistic shaded lighting poster by Ilya Kuvshinov katsuhiro, magali villeneuve, artgerm, Jeremy Lipkin and Michael Garmash, Rob Rey and Kentar� Miura style, trending on art station + When I have a subject in mind but I'm not yet sure about how I want the final image to look, I usually play around with magic prompt until I find something I like. I then use the generated prompt and tune from there. -I'm feeling lucky -================= -Another way of getting inspiration is through the I'm feeling lucky function. Instead of using a neural network, I'm feeling lucky uses the search engine on Lexica.art to find prompts that match your input. Quality may vary, but it is also a fun way to explore the latent space. +## I'm feeling lucky + +Another way of getting inspiration is through the I'm feeling lucky function. Instead of using a neural network, I'm feeling lucky uses the search engine on [Lexica.art](http://lexica.art) to find prompts that match your input. Quality may vary, but it is also a fun way to explore the latent space. + + +Using `mech-warrior` as my prompt, I get the following: + + giant oversized battle robot mech in battle pose is giant baby on a village, wooden fence and tree remains in far background, hero pose, Cinematic focus, Polaroid photo, vintage, neutral colors, soft lights, foggy, natural mysterous intricate detailed grainy photo, by Steve Hanks, by Serov Valentin, by lisa yuskavage, by Andrei Tarkovsky + + giant oversized battle robot mech as giant baby on a village, Cinematic focus, Polaroid photo, vintage, neutral colors, soft lights, foggy, by Steve Hanks, by Serov Valentin, by lisa yuskavage, by Andrei Tarkovsky + + a detailed manga illustration character full body portrait of a dark haired cyborg anime man who has a red mechanical eye, trending on artstation, digital art, 4 k resolution, detailed, high quality, sharp focus, hq artwork, insane detail, concept art, character concept, character illustration, full body illustration, cinematic, dramatic lighting + +Two points are worth noting. + +Firstly, in contrast to Magic Prompt, I'm feeling lucky prompts don't necessary contain our search string. +This is because Lexica performs a semantic search on its prompts database. This means the prompt should be relevant, even if the string doesn't match. + +Secondly, if you were to look for this prompt on the Lexica.art website, you wouldn't find the generated images. +This is because you almost certainly used different settings than the person who originally crafted the prompt. + +## Attention grabber + +Another way of adding a touch of variation to your images to by changing emphasis of various terms in the prompt. +Attention grabber randomly assigns emphasis to an existing prompt. +Starting with a previous I'm feeling lucky prompt: + + a detailed manga illustration character full body portrait of a dark haired cyborg anime man who has a red mechanical eye, trending on artstation, digital art, 4 k resolution, detailed, high quality, sharp focus, hq artwork, insane detail, concept art, character concept, character illustration, full body illustration, cinematic, dramatic lighting + +We add randomly add emphasis. For these images, I kept the seed constant so that you can see the impact of changing emphasis without changing any other settings. + + a detailed manga illustration character full body portrait of a dark haired cyborg anime man who has a red mechanical eye, trending on artstation, digital art, 4 k resolution, detailed, high quality, sharp focus, hq artwork, insane detail, concept art, character concept, character illustration, (full body illustration:1.58), cinematic, dramatic lighting + + a detailed manga illustration character full body portrait of a dark haired cyborg anime man who has a red mechanical eye, trending on artstation, digital art, 4 k resolution, detailed, high quality, sharp focus, hq artwork, insane detail, concept art, character concept, character illustration, (full body illustration:1.49), cinematic, dramatic lighting + + a detailed manga illustration character full body portrait of a dark haired cyborg anime man who has a red mechanical eye, trending on artstation, digital art, 4 k resolution, detailed, high quality, sharp focus, hq artwork, insane detail, concept art, character concept, (character illustration:1.26), full body illustration, cinematic, dramatic lighting + + +These changes are far more subtle and can be helpful if you want to explore slight changes to your image. +# Conclusion -Attention grabber -================= +This tutorial has covered the basics. There are additional features to try out once you feel comfortable using the tool. +You can find a list of syntax examples [here](SYNTAX.md).