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

Added functionality for wildcards (dynamic prompting à la progrock-stable) #738

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
11 changes: 10 additions & 1 deletion scripts/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,14 @@ def classToArrays( items, seed, n_iter ):

return all_seeds, n_iter, prompt_matrix_parts, all_prompts, needrows


def replace_wildcard(chunk):
if " " not in chunk:
file_dir = os.path.dirname(os.path.realpath("__file__"))
replacement_file = os.path.join(file_dir, f"scripts/wildcards/{chunk}.txt")
if os.path.exists(replacement_file):
with open(replacement_file, encoding="utf8") as f:
return random.choice(f.read().splitlines())
return chunk

def process_images(
outpath, func_init, func_sample, prompt, seed, sampler_name, skip_grid, skip_save, batch_size,
Expand Down Expand Up @@ -841,6 +848,8 @@ def process_images(

all_prompts = batch_size * n_iter * [prompt]
all_seeds = [seed + x for x in range(len(all_prompts))]

all_prompts = ["".join(replace_wildcard(chunk) for chunk in one_prompt.split("__")) for one_prompt in all_prompts]
original_seeds = all_seeds.copy()

precision_scope = autocast if opt.precision == "autocast" else nullcontext
Expand Down
181 changes: 181 additions & 0 deletions scripts/wildcards/adjective.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
abandoned
abhorrent
abrasive
adorable
ancient
angular
apocalyptic
aspiring
astonishing
atmospheric
average
beautiful
jtkelm2 marked this conversation as resolved.
Show resolved Hide resolved
biomechanical
blue
boorish
boring
capricious
clockwork
cloudy
cluttered
cold
colorful
colossal
complex
conscious
cool
cozy
cromulent
cute
cyberpunk
dazzling
deafening
delicate
delicious
delightful
deteriorating
dieselpunk
dilapidated
dire
disgusting
draconian
dramatic
dreamlike
dusty
dystopian
efficacious
elastic
elegant
elite
elusive
epic
evil
expressive
extraordinary
fallacious
fascinating
feigned
festive
fiery
flowery
foggy
frantic
fruit-flavored
functional
funny
futuristic
gentle
ghastly
ghostly
giant
gigantic
glamorous
glib
glowing
good
groovy
grouchy
gruesome
grumpy
harsh
hesitant
holistic
honorable
hyperdetailed
icy
ignorant
illuminated
impressive
incredibly detailed
interesting
jealous
kindhearted
level
lush
lyrical
macho
maniacal
masterpiece
matte
meek
metallic
metallic
mind-bending
minimalist
modular
moody
nasty
natural
neat
nonchalant
noxious
nutty
old
oppressive
otherworldly
overwrought
painterly
parched
pastel
petrified
pretty
primordial
psychadelic
psychotic
puny
rainbow
repressive
resonant
retrofuturistic
rich
rickety
ridiculous
rounded
ruined
rusty
secret
serene
serious
shadowy
shaky
sharp
shiny
simple
skillful
slimy
smart
sophisticated
spiritual
sprawling
squealing
steampunk
stimulating
stone
striped
sturdy
superficial
supersized
surreal
sweltering
swirling
tangible
terrifying
thundering
tiny
tough
tremendous
twisted
unadvised
unappetizing
underwater
unnatural
untidy
unusual
uptight
vengeful
vibrant
warlike
weird
wispy
witty
zany
Loading