From ab8300d1da26d9d3925ca23f3be0b3bfe9c6542d Mon Sep 17 00:00:00 2001 From: AIrjen Date: Mon, 1 Apr 2024 21:19:09 +0200 Subject: [PATCH] some node fixes for superprompter --- build_dynamic_prompt.py | 16 ++++++---------- csvfiles/superprompter_styles.csv | 1 - scripts/onebuttonprompt.py | 13 +++++++++++-- superprompter/requirements.txt | 4 ++++ 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 superprompter/requirements.txt diff --git a/build_dynamic_prompt.py b/build_dynamic_prompt.py index b24c326..069c97b 100644 --- a/build_dynamic_prompt.py +++ b/build_dynamic_prompt.py @@ -4723,7 +4723,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s descriptorlist = csv_to_list("descriptors") usestyle = False - if(superpromptstyle != "" or superpromptstyle != "all"): + if(superpromptstyle != "" and superpromptstyle != "all"): usestyle = True restofprompt = restofprompt.lower() @@ -4775,7 +4775,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s "firstname": "", "job": "person", "fictional": "fictional character", - "non fictional": "celebrity", + "non fictional": "person", "human": "person", "animal": "animal", "animal as human": "human creature", @@ -4797,8 +4797,8 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s # for insanitylevel in range(1,11): j = 0 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) + max_new_tokens = max_new_tokens_lookup.get(insanitylevel, 70) + top_p = top_p_lookup.get(insanitylevel, 1.6) subject_to_generate = chosensubject_lookup.get(chosensubject, "") translation_table_remove_stuff = str.maketrans('', '', '.,:()<>|[]"" ') @@ -4820,7 +4820,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s gender = "" if(superpromptstyle == "" or superpromptstyle == "all"): if "fantasy" in restofprompt or "d&d" in restofprompt or "dungeons and dragons" in restofprompt or "dungeons and dragons" in restofprompt: - superpromptstyle = random.choice(["fantasy style","d&d style"]) + superpromptstyle = "fantasy style" elif "sci-fi" in restofprompt or "scifi" in restofprompt or "science fiction" in restofprompt: superpromptstyle = random.choice(["sci-fi style","futuristic"]) elif "cyberpunk" in restofprompt: @@ -4856,10 +4856,6 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s elif "game" in restofprompt: imagetype = "video game artwork" - usestyle = False - - - if imagetype != "" and (normal_dist(insanitylevel) or usestyle == True): question += "Expand the following " + gender + " " + subject_to_generate + " prompt to describe " + superpromptstyle + " " + imagetype + ": " elif imagetype != "": @@ -4882,7 +4878,7 @@ def one_button_superprompt(insanitylevel = 5, prompt = "", seed = -1, override_s 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)) diff --git a/csvfiles/superprompter_styles.csv b/csvfiles/superprompter_styles.csv index c622c16..c0c87a2 100644 --- a/csvfiles/superprompter_styles.csv +++ b/csvfiles/superprompter_styles.csv @@ -10,7 +10,6 @@ cinematic cute cyberpunk demonic -d&d style dark elegant epic diff --git a/scripts/onebuttonprompt.py b/scripts/onebuttonprompt.py index dbdd246..0612098 100644 --- a/scripts/onebuttonprompt.py +++ b/scripts/onebuttonprompt.py @@ -654,9 +654,11 @@ class Script(scripts.Script): A simple and quick implementiation of Fooocus prompt magic - πŸ€“ Prompt enhancer + πŸ¦Έβ€β™‚οΈπŸ’¬ Prompt enhancer - Choose for "superprompter" to super prompt the prompts + Choose for "superprompter" to super prompt the prompts. + + Please install requirements for superprompter before use. """ @@ -670,6 +672,13 @@ class Script(scripts.Script): with gr.Row(variant="compact"): promptenhancer = gr.Dropdown( prompt_enhancers, label="πŸ€“ Prompt enhancer", value="none") + with gr.Row(variant="compact"): + gr.Markdown(""" + + Other options + + """ + ) with gr.Row(variant="compact"): with gr.Column(variant="compact"): promptcompounderlevel = gr.Dropdown( diff --git a/superprompter/requirements.txt b/superprompter/requirements.txt new file mode 100644 index 0000000..8a136e6 --- /dev/null +++ b/superprompter/requirements.txt @@ -0,0 +1,4 @@ +transformers +einops +accelerate +sentencepiece \ No newline at end of file