From b2110405378c4d2c7c9e1ccfdc3e9a09b3cc5c48 Mon Sep 17 00:00:00 2001 From: AIrjen Date: Sat, 30 Mar 2024 09:49:02 +0100 Subject: [PATCH] getting there! --- build_dynamic_prompt.py | 75 ++++++++++++++++++--------- csvfiles/basicbitchdescriptors.csv | 7 +++ csvfiles/special_lists/wordcombis.csv | 2 +- csvfiles/superprompter_styles.csv | 25 +++++++++ prompttester.py | 2 +- 5 files changed, 85 insertions(+), 26 deletions(-) create mode 100644 csvfiles/superprompter_styles.csv diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index 3acff87..5301624 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -3273,7 +3273,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artists = "all prompt_g = cleanup(promptlist[1], advancedprompting, insanitylevel) prompt_l = cleanup((promptlist[0] + ", " + promptlist[2]).replace("of a",""), advancedprompting, insanitylevel) if("@@@" in completeprompt and superprompter == True): - load_models() + #load_models() promptlist = completeprompt.split("@@@") subjectprompt = cleanup(promptlist[1], advancedprompting, insanitylevel) superpromptresult = one_button_superprompt(insanitylevel=insanitylevel, prompt=subjectprompt, seed=seed, override_subject=givensubject, override_outfit=overrideoutfit) @@ -4706,9 +4706,13 @@ def split_prompt_to_words(text): def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_subject = "" , override_outfit = ""): if(seed <= 0): - seed = 1 + seed = random.randint(1,1000000) done = False + load_models() + + superprompterstyleslist = csv_to_list("superprompter_styles") + descriptorlist = csv_to_list("descriptors") temperature_lookup = { 1: 0.001, @@ -4724,14 +4728,14 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s } max_new_tokens_lookup = { - 1: 80, - 2: 80, - 3: 90, - 4: 90, - 5: 100, - 6: 100, - 7: 120, - 8: 120, + 1: 25, + 2: 30, + 3: 35, + 4: 40, + 5: 50, + 6: 70, + 7: 90, + 8: 100, 9: 150, 10: 255 } @@ -4753,10 +4757,10 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s 1: 0.1, 2: 0.5, 3: 1.0, - 4: 1.5, - 5: 2.0, - 6: 2.5, - 7: 3.0, + 4: 1.25, + 5: 1.5, + 6: 1.75, + 7: 2.0, 8: 4.0, 9: 7.0, 10: 15.0 @@ -4766,14 +4770,26 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s temperature = temperature_lookup.get(insanitylevel, 0.5) max_new_tokens = max_new_tokens_lookup.get(insanitylevel, 75) top_p = top_p_lookup.get(insanitylevel, 5.0) + + if(uncommon_dist(insanitylevel)): + question = "Expand the following prompt to make it more " + random.choice(descriptorlist) + elif(normal_dist(insanitylevel)): + question = "Expand the following prompt to make it more " + random.choice(superprompterstyleslist) + else: + question = "Expand the following prompt to add more detail: " + + translation_table_remove_stuff = str.maketrans('', '', '., ') + translation_table_remove_numbers = str.maketrans('', '', '0123456789') + + prompt = prompt.translate(translation_table_remove_numbers) + while done == False: print(seed) print(temperature) print(top_p) + print(question) - - question = "Expand the following prompt to add more detail: " - #question = "Expand the following prompt to make it more epic: " + 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) @@ -4796,29 +4812,40 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s superpromptresult = superpromptresult # If neither period nor comma exists, keep the entire text # check if its matching all words from the override: - words_to_check = override_subject.split() + override_outfit.split() + possible_words_to_check = override_subject.lower().split() + override_outfit.lower().split() + print(possible_words_to_check) + words_to_check = [] + words_to_remove = ['subject', 'solo', '1girl', '1boy'] + for word in possible_words_to_check: + word = word.translate(translation_table_remove_stuff) + if word not in words_to_remove: + if not word.startswith("-") and not word.endswith("-"): + words_to_check.append(word) + 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: - if word not in superpromptresult: + if word not in superpromptresult.lower() and word != "subject": i += 1 if(i==0 or j == 20): done = True + # slowly converge and change else: seed += 1 j += 1 - if(temperature < 5.0): - temperature += 0.4 + round((10/random.randint(15,25)),2) + if(temperature < 0.5): + temperature += 0.05 + round((1/random.randint(15,25)),2) else: - temperature -= 0.4 + temperature -= 0.1 - if(top_p < 2.0): - top_p += 0.2 + round((10/random.randint(25,35)),2) + if(top_p < 1.0): + top_p += 0.2 + round((1/random.randint(25,35)),2) else: top_p -= 0.3 + max_new_tokens += 3 diff --git a/csvfiles/basicbitchdescriptors.csv b/csvfiles/basicbitchdescriptors.csv index a4d705b..70a3aae 100644 --- a/csvfiles/basicbitchdescriptors.csv +++ b/csvfiles/basicbitchdescriptors.csv @@ -1,3 +1,4 @@ +adorable alluring appealing attractive @@ -5,13 +6,19 @@ beautiful charming cozy cute +dynamic elegant +ethereal +epic exquisite flawless glamourous good-looking gorgeous +kawaii lovely +noir magnificent +mundane pleasant pretty \ No newline at end of file diff --git a/csvfiles/special_lists/wordcombis.csv b/csvfiles/special_lists/wordcombis.csv index 0c00c33..6a1768a 100644 --- a/csvfiles/special_lists/wordcombis.csv +++ b/csvfiles/special_lists/wordcombis.csv @@ -1,4 +1,4 @@ -alluring, appealing, attractive, beautiful, charming, cozy, cute, elegant, exquisite, flawless, glamourous, good-looking, gorgeous, lovely, magnificent, pleasant, pretty +adorable, alluring, appealing, attractive, beautiful, charming, cozy, cute, elegant, exquisite, flawless, glamourous, good-looking, gorgeous, lovely, magnificent, pleasant, pretty gothic, dark, moody, monochromatic, gritty, grim, macabre, goth, horror, baroque dirty, grimy, gritty creepy, scary, horror, monster, monstrous, macabre diff --git a/csvfiles/superprompter_styles.csv b/csvfiles/superprompter_styles.csv new file mode 100644 index 0000000..037ed93 --- /dev/null +++ b/csvfiles/superprompter_styles.csv @@ -0,0 +1,25 @@ +artful +adorable +alluring +appealing +attractive +beautiful +charming +cozy +cute +dark +elegant +epic +exquisite +fantastical +flawless +glamourous +grimy +gorgeous +humorous +lovely +magnificent +modern +pleasant +pretty +whymsical \ No newline at end of file diff --git a/prompttester.py b/prompttester.py index 86f45fd..80f6db0 100644 --- a/prompttester.py +++ b/prompttester.py @@ -35,7 +35,7 @@ def generateprompts(amount = 1,insanitylevel="5",subject="all", artist="all", im # superpromptresult2 = answer(input_text="Help me prompt this a little bit better and concise: """ + result + "" , max_new_tokens=150, repetition_penalty=1.5, temperature=0.5, top_p=0.1, top_k=10, seed=seed) # superpromptresult3 = answer(input_text="Make this more artful: """ + result + "" , max_new_tokens=150, repetition_penalty=1.5, temperature=5.0, top_p=5, top_k=1, seed=seed) # superpromptresult4 = answer(input_text="Describe this for me please: """ + result + "" , max_new_tokens=150, repetition_penalty=1.5, temperature=5.0, top_p=5, top_k=1, seed=seed) - #unload_models() + # unload_models() #print (result + " --- " + superpromptresult1 + " --- " + superpromptresult2 + " --- " + superpromptresult3 + " --- " + superpromptresult4)