Merge pull request #3 from AIrjen/Fix_batching_issue

Fix batching issue
This commit is contained in:
AIrjen
2023-04-10 16:15:27 +02:00
committed by GitHub
17 changed files with 146 additions and 24 deletions
+11 -1
View File
@@ -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
+8 -1
View File
@@ -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-
1 Glasses
81 Tail
82 Tattoos
83 Scars
84 large -color- eyes
85 glowing -color- eyes
86 Horns
87 Freckles
88 Medallion
89 Crown
90 Tiara
91 Mask made out of -material-
+15 -2
View File
@@ -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
1 puppy dog animal
1 animal
2 creature
3 Fish
4 bird
5 puppy dog puppy dog
6 cat cat
7 badger badger
48 Clam Clam
49 Oyster Oyster
50 Snail Snail
51 Ladybird
52 Slug Slug
53 Ant Ant
54 Bee Bee
150 Giant wasp Giant wasp
151 Giant bat Giant bat
152 Roc Roc
Thunderbird
153 Yeti Yeti
154 Sasquatch Sasquatch
155 Bigfoot Bigfoot
315 Saint Bernard Saint Bernard
316 Jack Russell Terrier Jack Russell Terrier
317 -material- dragon -material- dragon
318 -color- dragon -color- dragon
319 Tyrannosaurus Rex
320 Stegosaurus
321 Velociraptor
322 Triceratops
323 Brachiosaurus
324 Allosaurus
325 Ankylosaurus
326 Diplodocus
327 Pterodactyl
+3 -1
View File
@@ -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
1 Archticture
12 Cathedral
13 Church
14 Temple
15 Shrine
16 Mosque
17 Synagogue
18 Library
149 Wind turbine
150 Nuclear missile silo
151 Dungeon
152 Gate
153 Botanical Garden
+2 -1
View File
@@ -33,4 +33,5 @@ Colorless
Vivid
Vibrant
Iridescent
Neon
Neon
Lime green
1 Red
33 Vivid
34 Vibrant
35 Iridescent
36 Neon
37 Lime green
+3 -1
View File
@@ -80,4 +80,6 @@ Eye
Father
Mother
Gates
Dungeon
Dungeon
Conjurer
Garden
1 Ocean
80 Father
81 Mother
82 Gates
83 Dungeon
84 Conjurer
85 Garden
+4 -1
View File
@@ -65,4 +65,7 @@ Ancients
Longing
Doom
Heaven
Hell
Hell
Elements
Earth
Bounty
1 Infinity
65 Longing
66 Doom
67 Heaven
68 Hell
69 Elements
70 Earth
71 Bounty
+19 -1
View File
@@ -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
1 Handsome
111 Loathsome
112 Abominable
113 Horrid
114 Happy
115 Horrifying
116 Terrible
117 Gruesome
227 Viking
228 Maximalist
229 Bohemian
230 Glad
231 Folded
232 Glam
233 Chic
234 Japandi
308 Burning
309 Flaming
310 Feminine
311 Masculine
312 Cartoony
313 2000's
314 1990's
315 1980's
316 1970's
317 1960's
318 1950's
319 1940's
320 1940's
321 1920's
322 1900's
323 1800's
324 1700's
325 1600's
326 Luminescent
+3 -1
View File
@@ -513,4 +513,6 @@ Eevee
Gyarados
Dragonite
John Wick
Captain -material-beard
Captain -material-beard
-animal-man
Poison Ivy from Batman
1 Harry Potter
513 Gyarados
514 Dragonite
515 John Wick
516 Captain -material-beard
517 -animal-man
518 Poison Ivy from Batman
+30 -1
View File
@@ -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
1 Elf
90 Gorgon
91 Centaur
92 Satyr
93 Faun
94 Nightelf
95 Drow
96 Dunmer
97 Altmer
98 High elf
99 Argonian
100 Bosmer
101 Khajit
102 Orsimer
103 Redguard
104 Dwemer
105 Falmer
106 Atronach
107 Daedra
108 Draugr
109 Fremen
110 Mentat
111 Bene Gesserit
112 Draenei
113 Worgen
114 Pandaren
115 Undead
116 Dracthyr
117 Tauren
118 Bloodelf
119 Voidelf
120 Zandalari
121 Murloc
122 Elemental
+17 -1
View File
@@ -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
1 Grand Canyon
637 Mountain
638 Statue of Liberty
639 Biosphere
640 Tropical Island
641 Elder scrolls
642 Whiterun
643 Tamriel
644 Cyrodiil
645 Morrowind
646 Oblivion
647 Skyrim
648 Hammerfell
649 Bruma
650 Balmora
651 Vivec City
652 Riften
653 Stormwind
654 Orgrimmar
655 Ironforge
656 Tristram
+1 -1
View File
@@ -90,7 +90,7 @@ Donegal tweed
Camel hair
Kashmiri shawls
Waxed cotton
Sashiko cloth
Cloth
Gold
Silver
Iron
1 Wood
90 Camel hair
91 Kashmiri shawls
92 Waxed cotton
93 Sashiko cloth Cloth
94 Gold
95 Silver
96 Iron
+4 -1
View File
@@ -374,4 +374,7 @@ Poppies
Hydrangeas
Irises
Marigolds
-object- in a bottle
-object- in a bottle
Cup of Coffee
Cup of Tea
Faberge egg
1 Pen
374 Hydrangeas
375 Irises
376 Marigolds
377 -object- in a bottle
378 Cup of Coffee
379 Cup of Tea
380 Faberge egg
+4 -1
View File
@@ -65,4 +65,7 @@ Movie poster
-material-
Tarot card
Playing card
Fantasy concept art
Fantasy concept art
Cartoon
Mixed media
Cover Art
1 Concept sheet
65 -material-
66 Tarot card
67 Playing card
68 Fantasy concept art
69 Cartoon
70 Mixed media
71 Cover Art
+4 -1
View File
@@ -22,4 +22,7 @@ sunbeam
Film grain
crisp lines
Swirling
-color- explosions
Ribbons
Spirals
-color- explosions
Folded -material-
1 Golden ratio
22 Film grain
23 crisp lines
24 Swirling
25 -color- explosions Ribbons
26 Spirals
27 -color- explosions
28 Folded -material-
+1 -1
View File
@@ -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
+17 -7
View File
@@ -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)