Merge pull request #3 from AIrjen/Fix_batching_issue
Fix batching issue
This commit is contained in:
+11
-1
@@ -292,7 +292,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
|
||||
completeprompt = add_from_csv(completeprompt, "human_activities", 1, "","")
|
||||
|
||||
if(subjectchooser in ["animal as human","human","job", "fictional", "non fictional", "humanoid"] and legendary_dist(insanitylevel)):
|
||||
completeprompt += " with -color- skin, "
|
||||
completeprompt += ", with -color- skin, "
|
||||
|
||||
# outfit builder
|
||||
if(subjectchooser in ["animal as human","human","fictional", "non fictional", "humanoid"] and normal_dist(insanitylevel)):
|
||||
@@ -418,7 +418,17 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
|
||||
while "-animal-" in completeprompt:
|
||||
completeprompt = completeprompt.replace('-animal-', random.choice(animallist),1)
|
||||
|
||||
completeprompt = re.sub('\[ ', '[', completeprompt)
|
||||
completeprompt = re.sub(' \]', ']', completeprompt)
|
||||
completeprompt = re.sub(' \|', '|', completeprompt)
|
||||
completeprompt = re.sub(' \"', '\"', completeprompt)
|
||||
completeprompt = re.sub('\" ', '\"', completeprompt)
|
||||
completeprompt = re.sub('\( ', '(', completeprompt)
|
||||
completeprompt = re.sub(' \(', '(', completeprompt)
|
||||
completeprompt = re.sub('\) ', ')', completeprompt)
|
||||
completeprompt = re.sub(' \)', ')', completeprompt)
|
||||
|
||||
completeprompt = re.sub(',,', ',', completeprompt)
|
||||
completeprompt = re.sub(', ,', ',', completeprompt)
|
||||
completeprompt = re.sub(' , ', ',', completeprompt)
|
||||
completeprompt = re.sub(' +', ' ', completeprompt[2:]) # remove first character, that is always a comma. Remove any excess spaces
|
||||
|
||||
@@ -81,4 +81,11 @@ Cat Ears
|
||||
Tail
|
||||
Tattoos
|
||||
Scars
|
||||
large -color- eyes
|
||||
large -color- eyes
|
||||
glowing -color- eyes
|
||||
Horns
|
||||
Freckles
|
||||
Medallion
|
||||
Crown
|
||||
Tiara
|
||||
Mask made out of -material-
|
||||
|
+15
-2
@@ -1,3 +1,7 @@
|
||||
animal
|
||||
creature
|
||||
Fish
|
||||
bird
|
||||
puppy dog
|
||||
cat
|
||||
badger
|
||||
@@ -44,6 +48,7 @@ Shrimp
|
||||
Clam
|
||||
Oyster
|
||||
Snail
|
||||
Ladybird
|
||||
Slug
|
||||
Ant
|
||||
Bee
|
||||
@@ -145,7 +150,6 @@ Giant bee
|
||||
Giant wasp
|
||||
Giant bat
|
||||
Roc
|
||||
Thunderbird
|
||||
Yeti
|
||||
Sasquatch
|
||||
Bigfoot
|
||||
@@ -311,4 +315,13 @@ Shar Pei
|
||||
Saint Bernard
|
||||
Jack Russell Terrier
|
||||
-material- dragon
|
||||
-color- dragon
|
||||
-color- dragon
|
||||
Tyrannosaurus Rex
|
||||
Stegosaurus
|
||||
Velociraptor
|
||||
Triceratops
|
||||
Brachiosaurus
|
||||
Allosaurus
|
||||
Ankylosaurus
|
||||
Diplodocus
|
||||
Pterodactyl
|
||||
|
@@ -12,6 +12,7 @@ Palace
|
||||
Cathedral
|
||||
Church
|
||||
Temple
|
||||
Shrine
|
||||
Mosque
|
||||
Synagogue
|
||||
Library
|
||||
@@ -148,4 +149,5 @@ Quarry
|
||||
Wind turbine
|
||||
Nuclear missile silo
|
||||
Dungeon
|
||||
Gate
|
||||
Gate
|
||||
Botanical Garden
|
||||
|
+2
-1
@@ -33,4 +33,5 @@ Colorless
|
||||
Vivid
|
||||
Vibrant
|
||||
Iridescent
|
||||
Neon
|
||||
Neon
|
||||
Lime green
|
||||
|
@@ -80,4 +80,6 @@ Eye
|
||||
Father
|
||||
Mother
|
||||
Gates
|
||||
Dungeon
|
||||
Dungeon
|
||||
Conjurer
|
||||
Garden
|
||||
|
@@ -65,4 +65,7 @@ Ancients
|
||||
Longing
|
||||
Doom
|
||||
Heaven
|
||||
Hell
|
||||
Hell
|
||||
Elements
|
||||
Earth
|
||||
Bounty
|
||||
|
@@ -111,6 +111,7 @@ Foul
|
||||
Loathsome
|
||||
Abominable
|
||||
Horrid
|
||||
Happy
|
||||
Horrifying
|
||||
Terrible
|
||||
Gruesome
|
||||
@@ -226,6 +227,8 @@ Victorian
|
||||
Viking
|
||||
Maximalist
|
||||
Bohemian
|
||||
Glad
|
||||
Folded
|
||||
Glam
|
||||
Chic
|
||||
Japandi
|
||||
@@ -305,4 +308,19 @@ Fluid
|
||||
Burning
|
||||
Flaming
|
||||
Feminine
|
||||
Masculine
|
||||
Masculine
|
||||
Cartoony
|
||||
2000's
|
||||
1990's
|
||||
1980's
|
||||
1970's
|
||||
1960's
|
||||
1950's
|
||||
1940's
|
||||
1940's
|
||||
1920's
|
||||
1900's
|
||||
1800's
|
||||
1700's
|
||||
1600's
|
||||
Luminescent
|
||||
|
@@ -513,4 +513,6 @@ Eevee
|
||||
Gyarados
|
||||
Dragonite
|
||||
John Wick
|
||||
Captain -material-beard
|
||||
Captain -material-beard
|
||||
-animal-man
|
||||
Poison Ivy from Batman
|
||||
|
+30
-1
@@ -90,4 +90,33 @@ Werewolf
|
||||
Gorgon
|
||||
Centaur
|
||||
Satyr
|
||||
Faun
|
||||
Faun
|
||||
Nightelf
|
||||
Drow
|
||||
Dunmer
|
||||
Altmer
|
||||
High elf
|
||||
Argonian
|
||||
Bosmer
|
||||
Khajit
|
||||
Orsimer
|
||||
Redguard
|
||||
Dwemer
|
||||
Falmer
|
||||
Atronach
|
||||
Daedra
|
||||
Draugr
|
||||
Fremen
|
||||
Mentat
|
||||
Bene Gesserit
|
||||
Draenei
|
||||
Worgen
|
||||
Pandaren
|
||||
Undead
|
||||
Dracthyr
|
||||
Tauren
|
||||
Bloodelf
|
||||
Voidelf
|
||||
Zandalari
|
||||
Murloc
|
||||
Elemental
|
||||
|
+17
-1
@@ -637,4 +637,20 @@ Landfill
|
||||
Mountain
|
||||
Statue of Liberty
|
||||
Biosphere
|
||||
Tropical Island
|
||||
Tropical Island
|
||||
Elder scrolls
|
||||
Whiterun
|
||||
Tamriel
|
||||
Cyrodiil
|
||||
Morrowind
|
||||
Oblivion
|
||||
Skyrim
|
||||
Hammerfell
|
||||
Bruma
|
||||
Balmora
|
||||
Vivec City
|
||||
Riften
|
||||
Stormwind
|
||||
Orgrimmar
|
||||
Ironforge
|
||||
Tristram
|
||||
|
@@ -90,7 +90,7 @@ Donegal tweed
|
||||
Camel hair
|
||||
Kashmiri shawls
|
||||
Waxed cotton
|
||||
Sashiko cloth
|
||||
Cloth
|
||||
Gold
|
||||
Silver
|
||||
Iron
|
||||
|
||||
|
@@ -374,4 +374,7 @@ Poppies
|
||||
Hydrangeas
|
||||
Irises
|
||||
Marigolds
|
||||
-object- in a bottle
|
||||
-object- in a bottle
|
||||
Cup of Coffee
|
||||
Cup of Tea
|
||||
Faberge egg
|
||||
|
@@ -65,4 +65,7 @@ Movie poster
|
||||
-material-
|
||||
Tarot card
|
||||
Playing card
|
||||
Fantasy concept art
|
||||
Fantasy concept art
|
||||
Cartoon
|
||||
Mixed media
|
||||
Cover Art
|
||||
|
+4
-1
@@ -22,4 +22,7 @@ sunbeam
|
||||
Film grain
|
||||
crisp lines
|
||||
Swirling
|
||||
-color- explosions
|
||||
Ribbons
|
||||
Spirals
|
||||
-color- explosions
|
||||
Folded -material-
|
||||
|
@@ -19,7 +19,7 @@ steps = 0
|
||||
|
||||
while steps < loops:
|
||||
# build prompt
|
||||
randomprompt = build_dynamic_prompt(5,"animal","all","all")
|
||||
randomprompt = build_dynamic_prompt(5,"all","all","all")
|
||||
|
||||
# prompt + size
|
||||
|
||||
|
||||
@@ -102,21 +102,31 @@ class Script(scripts.Script):
|
||||
def run(self, p, insanitylevel, subject, artist, imagetype):
|
||||
|
||||
images = []
|
||||
infotexts = []
|
||||
|
||||
if p.prompt != "":
|
||||
print("Prompt is not empty, adding current prompt to the end of the generated prompt")
|
||||
|
||||
batches = p.n_iter
|
||||
print(batches)
|
||||
initialbatchsize = p.batch_size
|
||||
batchsize = p.batch_size
|
||||
p.n_iter = 1
|
||||
p.batch_size = 1
|
||||
|
||||
|
||||
# todo: somehow it duplicates the batch when handling multiple batches. To fix!
|
||||
for i in range(batches):
|
||||
p.prompt = build_dynamic_prompt(insanitylevel,subject,artist, imagetype) + ", " + p.prompt # add existing prompt to the back?
|
||||
print(i)
|
||||
processed = process_images(p)
|
||||
images += processed.images
|
||||
for j in range(batchsize):
|
||||
|
||||
processed = process_images(p)
|
||||
images += processed.images
|
||||
infotexts += processed.infotexts
|
||||
|
||||
# just return the prompt, and webui will do the rest
|
||||
# Only move up a seed, when there are multiple batchsizes, and we had the first one done.
|
||||
if(initialbatchsize != 1):
|
||||
p.seed += 1
|
||||
|
||||
# just return all the things
|
||||
p.n_iter = 0
|
||||
p.batch_size = 0
|
||||
return Processed(p=p, images_list=images)
|
||||
return Processed(p=p, images_list=images, info=infotexts[0], infotexts=infotexts)
|
||||
Reference in New Issue
Block a user