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
12 changes: 11 additions & 1 deletion scripts/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,15 @@ 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:
jtkelm2 marked this conversation as resolved.
Show resolved Hide resolved
file_dir = os.path.dirname(os.path.realpath("__file__"))
replacement_file = os.path.join(file_dir, "scripts/wildcards/" + chunk + ".txt")
jtkelm2 marked this conversation as resolved.
Show resolved Hide resolved
if os.path.exists(replacement_file):
lines = open(replacement_file, encoding="utf8").read().splitlines()
my_line = random.choice(lines)
return(my_line)
return(chunk)
jtkelm2 marked this conversation as resolved.
Show resolved Hide resolved

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

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

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