From 6856a6b8ab308f2cf954837dabd262ff9f38f5ac Mon Sep 17 00:00:00 2001 From: AIrjen Date: Wed, 3 Apr 2024 21:32:24 +0200 Subject: [PATCH] clean up for superprompt model --- OneButtonPromptNodes.py | 4 +- build_dynamic_prompt.py | 37 ++-- csvfiles/devmessages_superprompt.csv | 274 +++++++++++++++++++++++++++ scripts/onebuttonprompt.py | 9 +- superprompter/superprompter.py | 13 +- 5 files changed, 308 insertions(+), 29 deletions(-) create mode 100644 csvfiles/devmessages_superprompt.csv diff --git a/OneButtonPromptNodes.py b/OneButtonPromptNodes.py index 27d3346..6474146 100644 --- a/OneButtonPromptNodes.py +++ b/OneButtonPromptNodes.py @@ -25,7 +25,7 @@ genders = ["all", "male", "female"] emojis = [False, True] models = ["SD1.5", "SDXL", "Stable Cascade"] -prompt_enhancers = ["none", "superprompter"] +prompt_enhancers = ["none", "superprompt-v1"] subjects =["all"] subjectsubtypesobject = ["all"] subjectsubtypeshumanoid = ["all"] @@ -692,7 +692,7 @@ class OneButtonSuperPrompt: CATEGORY = "OneButtonPrompt" def Comfy_OBP_SuperPrompt(self, insanitylevel, prompt, superpromptstyle, seed): - # artify here + OBPsuperprompt = one_button_superprompt(insanitylevel=insanitylevel, prompt=prompt, seed=seed, superpromptstyle=superpromptstyle) print("Super prompt: " + OBPsuperprompt) diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 069c97b..bc9181c 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -21,7 +21,8 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all add_quality = True superprompter = False - if(prompt_enhancer == "superprompter"): + prompt_enhancer = prompt_enhancer.lower() + if(prompt_enhancer == "superprompter" or prompt_enhancer == "superprompt" or prompt_enhancer == "superprompt-v1"): superprompter = True if(superprompter==True): base_model = "Stable Cascade" @@ -4721,6 +4722,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s superprompterstyleslist = csv_to_list("superprompter_styles") descriptorlist = csv_to_list("descriptors") + devmessagessuperpromptlist = csv_to_list("devmessages_superprompt") usestyle = False if(superpromptstyle != "" and superpromptstyle != "all"): @@ -4763,8 +4765,8 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s 5: 1.6, 6: 1.75, 7: 2.0, - 8: 4.0, - 9: 7.0, + 8: 3.0, + 9: 5.0, 10: 15.0 } @@ -4806,7 +4808,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s # check if its matching all words from the override: possible_words_to_check = override_subject.lower().split() + override_outfit.lower().split() - print(possible_words_to_check) + # print(possible_words_to_check) words_to_check = [] words_to_remove = ['subject', 'solo', '1girl', '1boy'] for word in possible_words_to_check: @@ -4871,20 +4873,20 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s prompt = prompt.translate(translation_table_remove_numbers) while done == False: - print(seed) - print(temperature) - print(top_p) - print(question) - print("chosen subject: " + chosensubject) + #print(seed) + #print(temperature) + #print(top_p) + #print(question) + #print("chosen subject: " + chosensubject) - superpromptresult = answer(input_text=question + '"' + prompt + '"', max_new_tokens=max_new_tokens, repetition_penalty=2.0, temperature=temperature, top_p=top_p, top_k=10, seed=seed) + superpromptresult = answer(input_text=question + prompt, max_new_tokens=max_new_tokens, repetition_penalty=2.0, temperature=temperature, top_p=top_p, top_k=10, seed=seed) - print("orignal: " + prompt) - print("insanitylevel: " + str(insanitylevel)) - print("") - print("complete superprompt: " + superpromptresult) - print("") + #print("orignal: " + prompt) + #print("insanitylevel: " + str(insanitylevel)) + #print("") + #print("complete superprompt: " + superpromptresult) + #print("") # Find the indices of the nearest period and comma period_index = superpromptresult.rfind('.') @@ -4900,7 +4902,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s superpromptresult = superpromptresult # If neither period nor comma exists, keep the entire text - print(words_to_check) + #print(words_to_check) # Iterate through each word and check if it exists in the other string i = 0 for word in words_to_check: @@ -4924,6 +4926,9 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s else: top_p -= 0.3 max_new_tokens += 3 + print("") + print(random.choice(devmessagessuperpromptlist) + "... Retrying...") + print("") diff --git a/csvfiles/devmessages_superprompt.csv b/csvfiles/devmessages_superprompt.csv new file mode 100644 index 0000000..0d71f63 --- /dev/null +++ b/csvfiles/devmessages_superprompt.csv @@ -0,0 +1,274 @@ +Wrong prompt +Not enough sizzle in prompt +¡Dangerous prompt! +Prompt too strange +Prompt too difficult +Error 404: Prompt Not Found +Oops! Prompt malfunction detected +Too many twists and turns in that prompt +Not feeling the vibe with this prompt +Warning: Prompt complexity overload +Oops, that prompt was a swing and a miss +Lost in translation: prompt edition +Current prompt not up to standard +Dialing down the jargon, dialing up the clarity +Prompt too dry, needs more flavor +Prompt overload detected +Error: Prompt mismatch +Too many loops in this prompt +Prompt not sparking joy +Error 101: Prompt not engaging +Lost in the prompt maze +Prompt lost in translation +Not enough zest in that prompt +Low prompt battery +Current prompt not up to par +Error: Prompt not resonating +Prompt feeling flat +Insufficient prompt energy detected +Whoops! Prompt malfunction detected +Lost in prompt translation +Prompt too vague +Error: Prompt foggy +Current prompt on the fritz +Not feeling the prompt vibe +Alert: Prompt not compatible +Prompt needs more spice +Error: Prompt complexity overload +Lost in the prompt abyss +Prompt lost in cyberspace +Prompt engine overheating +Prompt malfunction detected +Current prompt not up to snuff +Prompt not hitting the mark +Error: Prompt circuit overloaded +Prompt stuck in a loop +Insufficient prompt enthusiasm detected +Error: Prompt turbulence detected +Prompt lost in the ether +Prompt not passing the vibe check +Prompt not quite right +Whoops! Prompt glitch detected +Prompt signal lost +Prompt not resonating +Error: Prompt overload +Prompt under construction +Prompt not firing on all cylinders +Error: Prompt malfunction detected +Prompt lost in the data stream +Whoops! Prompt hiccup detected +Prompt not quite hitting the mark +Alert: Prompt overload detected +Oops! Prompt took a detour through the imagination +Lost in the labyrinth of prompts +Error: Prompt caught in a time loop +Whoops! Prompt got tangled in the web of ideas +Alert: Prompt ventured into the realm of the absurd +Prompt lost its passport to creativity +Error: Prompt collided with a parallel universe +Oops! Prompt fell down the rabbit hole of abstraction +Lost in the cosmic soup of prompts +Prompt wandered off into the wilderness of whimsy +Error: Prompt got lost in the maze of metaphors +Oops! Prompt got stranded on the island of ambiguity +Alert: Prompt caught in the whirlwind of creativity +Lost in the galaxy of prompts +Error: Prompt glitched into the realm of the surreal +Oops! Prompt took a wrong turn at the crossroads of ideas +Alert: Prompt drifted into the sea of abstraction +Lost in the jungle of prompts +Error: Prompt ventured into the twilight zone of creativity +Oops! Prompt stumbled into the hall of mirrors of ideas +Alert: Prompt sailed into the storm of creativity +Lost in the wilderness of prompts +Error: Prompt got entangled in the web of abstraction +Oops! Prompt strayed into the realm of fantasy +Alert: Prompt drifted into the fog of creativity +Error: Prompt took a quantum leap into the unknown +Oops! Prompt vanished into the nebula of abstraction +Alert: Prompt slipped through the cracks of creativity +Lost in the cosmic dance of prompts +Error 404: Quantum flux in prompt matrix +Alert: Prompt subsystem overridden by recursive algorithm +Critical error: Prompt buffer overflow detected +Warning: Prompt encryption protocol compromised +Error 101: Prompt neural network divergence +Alert: Prompt quantum entanglement disrupting coherence +Critical error: Prompt quantum tunneling disrupting data flow +Warning: Prompt hyperdrive malfunction causing temporal distortion +Error 404: Prompt quantum resonance frequency mismatch +Alert: Prompt nanite swarm infestation detected +Critical error: Prompt phase inversion in virtual reality interface +Warning: Prompt subspace interference distorting data packets +Error 101: Prompt quantum entanglement entropic decay +Alert: Prompt AI heuristic algorithms in conflict +Critical error: Prompt quantum computing flux causing algorithmic divergence +Warning: Prompt holographic interference disrupting visual cortex synchronization +Error 404: Prompt quantum superposition collapse detected +Alert: Prompt dimensional instability causing data corruption +Critical error: Prompt neural interface desynchronization +Warning: Prompt quantum tunneling disrupting data transmission +Error 101: Prompt quantum flux modulation failure +Alert: Prompt AI subroutine divergence detected +Critical error: Prompt subspace distortion causing data fragmentation +Warning: Prompt neural network feedback loop detected +Error 404: Prompt hyperdimensional resonance mismatch +Alert: Prompt quantum encryption decryption failure +Critical error: Prompt data compression algorithm failure +Warning: Prompt temporal anomaly disrupting temporal synchronization +Error 101: Prompt nanotech swarm malfunction +Alert: Prompt holographic interface instability detected +Critical error: Prompt cybernetic interface desynchronization +Warning: Prompt quantum singularity fluctuation causing data instability +Error 404: Prompt neural interface synaptic overload +Alert: Prompt subspace distortion field collapse detected +Critical error: Prompt quantum data packet fragmentation detected +Warning: Prompt quantum entanglement cascade failure +Error 101: Prompt AI heuristic algorithmic loop detected +Alert: Prompt holographic projection phase inversion detected +Critical error: Prompt cybernetic neural feedback loop detected +Warning: Prompt quantum anomaly interference detected +Error 404: Prompt subspace transmission phase distortion detected +Alert: Prompt temporal flux capacitor failure detected +Critical error: Prompt neural interface synaptic misfire detected +Warning: Prompt quantum singularity resonance cascade detected +Error 101: Prompt nanotech swarm replication divergence detected +Error: Prompt ensnared in the webs of the Wyrdwood Forest +Alert: Prompt lost in the labyrinth of illusions +Critical error: Prompt trapped in the realm of shadows +Warning: Prompt bewitched by ancient runes +Error 404: Prompt vanished into the misty veil of the Feywild +Alert: Prompt ensorcelled by the whispers of the Dark Sorcerer +Critical error: Prompt swallowed by the maelstrom of elemental chaos +Warning: Prompt imprisoned within the crystalline walls of the Ice Citadel +Error: Prompt lost in the sands of time within the Hourglass of Eternity +Alert: Prompt ensnared in the siren's song of the enchanted waters +Critical error: Prompt entangled in the roots of the ancient World Tree +Warning: Prompt ensorcelled by the gaze of the Medusa's eyes +Error 404: Prompt swallowed by the depths of the Abyssal Chasm +Alert: Prompt ensnared in the threads of the Dreamweaver's loom +Critical error: Prompt ensorcelled by the cursed mirror of the Enchantress +Warning: Prompt trapped in the ethereal mist of the Whispering Woods +Error: Prompt entombed within the ancient crypts of the Necromancer +Alert: Prompt ensnared in the chains of the Infernal Forge +Critical error: Prompt lost in the shifting sands of the Desert Mirage +Warning: Prompt ensorcelled by the cursed flames of the Phoenix's pyre +Error 404: Prompt submerged in the depths of the Leviathan's lair +Alert: Prompt ensnared in the coils of the Basilisk's gaze +Critical error: Prompt entrapped within the infernal labyrinth of the Demon's Den +Warning: Prompt ensorcelled by the whispers of the Banshee's wail +Error: Prompt entwined in the thorns of the Darkwood Bramble +Alert: Prompt ensnared by the spectral chains of the Wraith King +Critical error: Prompt imprisoned within the cursed tome of the Lich Necromancer +Warning: Prompt lost in the shifting sands of the Desert of Illusions +Error: Prompt ensorcelled by the enchanting melody of the Siren's harp +Alert: Prompt trapped within the twisted vines of the Dark Enchanter's garden +Critical error: Prompt entangled in the web of fate spun by the Spinner of Destinies +Warning: Prompt ensnared by the whispers of the Shadow Realm +Error: Prompt lost in the fog of the Forgotten Marshes +Alert: Prompt ensorcelled by the illusions of the Mirage Sorcerer +Critical error: Prompt imprisoned within the crystal prison of the Ice Witch +Warning: Prompt entangled in the branches of the Whispering Willow +Error: Prompt ensnared by the tendrils of the Darkwood Ent +Alert: Prompt trapped within the cursed mirror of the Reflection Witch +Critical error: Prompt imprisoned within the labyrinth of the Minotaur's maze +Warning: Prompt ensorcelled by the venomous gaze of the Basilisk +Error: Prompt lost in the shifting sands of the Hourglass of Time +Alert: Prompt ensnared by the twisted branches of the Witchwood Grove +Critical error: Prompt imprisoned within the arcane sigils of the Wizard's Tower +Warning: Prompt entangled in the threads of the Spider Queen's web +Error: Prompt ensorcelled by the enchantments of the Enchanter's Garden +Alert: Prompt lost in the labyrinth of the Fey Realm +Critical error: Prompt imprisoned within the cursed mirror of the Night Hag +Warning: Prompt ensnared by the thorny vines of the Blood Rose Thicket +Error: Prompt lost in the mists of the Veil of Shadows +Alert: Prompt ensorcelled by the haunting whispers of the Ghostly Choir +Brushstrokes askew +Canvas of ideas marred +Symphony of prompts discordant +Sculpting the wrong form +Ink of inspiration diluted +Verse of the wrong cadence +Palette lacking in hues +Clay of ideas crumbling +Chords of creativity misaligned +Mosaic of thoughts fragmented +Easel of inspiration barren +Quill faltering on parchment +Gaze lost in the void of the blank canvas +Theatre of imagination dim +Note of inspiration off-key +Sculpture of ideas unformed +Palette lacking in texture +Stanza of the wrong meter +Gallery of ideas incomplete +Canvas of the mind blank +Artistry obscured by shadows +Palette of ideas monochrome +Sketch of inspiration incomplete +Verse of the wrong tempo +Sculpture of ideas shapeless +Palette of ideas muted +Brush of inspiration dry +Symphony of thoughts discordant +Canvas of imagination blank +Quill of inspiration stilled +Easel of ideas unsteady +Gallery of dreams unfinished +Palette of ideas scattered +Sketch of inspiration rough +Verse of ideas fragmented +Sculpture of thoughts formless +Canvas of dreams faded +Quill of ideas silent +Symphony of colors muted +Palette of inspiration limited +Easel of creativity blank +Gallery of muses silent +Sketch of ideas incomplete +Verse of imagination disjointed +Sculpture of dreams amorphous +Canvas of creativity blanketed in shadows +Quill of ideas inkless +Symphony of thoughts discordant +Palette of inspiration dulled +Easel of imagination skewed +Critical fail +Encounter with the wrong prompt +Spell misfire +Natural 1 on the prompt check +Trap sprung by the wrong prompt +Failed saving throw against the complexity of the prompt +Initiative rolled too low +Failed stealth check +Magic item misidentified +Encounter with the wrong monster +Failed persuasion attempt +Critical hit from the wrong prompt +Failed investigation roll +Natural 20 on the insight check +Failed wisdom saving throw +Failed intelligence check +Encounter with a mimic prompt +Spell fizzled against the resistant prompt +Failed dexterity saving throw +Encounter with the wrong NPC +Failed strength check +Encounter with the wrong artifact +Failed religion check +Failed deception attempt +Encounter with the wrong alignment +Failed survival check +Encounter with the wrong plane of existence +Failed athletics check +Encounter with the wrong prophecy +Failed medicine check +Encounter with the wrong magical school +Failed nature check +Encounter with the wrong artifact +Failed perception check +Encounter with the wrong legendary creature +Failed history check +Encounter with the wrong dungeon +Failed acrobatics check +Failed intimidation attempt \ No newline at end of file diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index 0612098..e051335 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -32,7 +32,7 @@ ANDtogglemode = ["none", "automatic", "prefix AND prompt + suffix", "prefix + pr seperatorlist = ["comma", "AND", "BREAK"] genders = ["all", "male", "female"] -prompt_enhancers = ["none", "superprompter"] +prompt_enhancers = ["none", "superprompt-v1"] qualitymodelist = ["highest", "gated"] qualitykeeplist = ["keep used","keep all"] @@ -656,9 +656,9 @@ class Script(scripts.Script): 🦸‍♂️💬 Prompt enhancer - Choose for "superprompter" to super prompt the prompts. + Choose for "superprompt-v1" to super prompt the prompts with roborovski superprompt-v1 model. - Please install requirements for superprompter before use. + Please install requirements for superprompt before use. """ @@ -675,7 +675,10 @@ class Script(scripts.Script): with gr.Row(variant="compact"): gr.Markdown(""" + Other options + + --- """ ) diff --git a/superprompter/superprompter.py b/superprompter/superprompter.py index 37acc4d..7f34887 100644 --- a/superprompter/superprompter.py +++ b/superprompter/superprompter.py @@ -14,17 +14,17 @@ def load_models(): if not all(os.path.exists(modelDir) for file in modelDir): print("Model files not found. Downloading...\n") download_models() - else: - print("Model files found. Skipping download.\n") + # else: + # print("Model files found. Skipping download.\n") - print("Loading SuperPrompt-v1 model...\n") + # print("Loading SuperPrompt-v1 model...\n") global tokenizer, model tokenizer = T5Tokenizer.from_pretrained(modelDir) model = T5ForConditionalGeneration.from_pretrained(modelDir, torch_dtype=torch.float16) - print("SuperPrompt-v1 model loaded successfully.\n") + # print("SuperPrompt-v1 model loaded successfully.\n") def unload_models(): global tokenizer, model @@ -39,7 +39,6 @@ def unload_models(): def answer(input_text="", max_new_tokens=512, repetition_penalty=1.2, temperature=0.5, top_p=1, top_k = 1 , seed=-1): - # if the seed is "0", generate a random seed and log it to the output if seed == -1: seed = random.randint(1, 1000000) @@ -59,7 +58,5 @@ def answer(input_text="", max_new_tokens=512, repetition_penalty=1.2, temperatur dirty_text = tokenizer.decode(outputs[0]) text = dirty_text.replace("", "").replace("", "").strip() - # print("Temperature: {temperature}\nTop P: {top_p}\nTop K: {top_k}\nSeed: {seed}\nOutput:\n\n") - - # print(text) + return text