From d94ba6e68b89154a682f730ed75f86663319c570 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 26 Jul 2023 07:26:37 -0700 Subject: [PATCH 1/7] Define visible_text before applying chat_input extensions --- modules/chat.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index 0e0e416c1d..f684768b63 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -175,10 +175,8 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess # Preparing the input if not any((regenerate, _continue)): + visible_text = text text, visible_text = apply_extensions('chat_input', text, visible_text, state) - if visible_text is None: - visible_text = text - text = apply_extensions('input', text, state) # *Is typing...* From b553c33dd0ed2397273af815ce892907fd13d508 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 26 Jul 2023 07:49:22 -0700 Subject: [PATCH 2/7] Add a link to the gradio docs --- docs/Extensions.md | 7 +++++-- extensions/example/script.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/Extensions.md b/docs/Extensions.md index 47047405ba..74189efd9e 100644 --- a/docs/Extensions.md +++ b/docs/Extensions.md @@ -232,8 +232,11 @@ def setup(): def ui(): """ - Gets executed when the UI is drawn. Custom gradio elements and their - corresponding event handlers should be defined here. + Gets executed when the UI is drawn. Custom gradio elements and + their corresponding event handlers should be defined here. + + To learn about gradio components, check out the docs: + https://gradio.app/docs/ """ pass ``` diff --git a/extensions/example/script.py b/extensions/example/script.py index 40bebad079..f81a652b26 100644 --- a/extensions/example/script.py +++ b/extensions/example/script.py @@ -128,7 +128,10 @@ def setup(): def ui(): """ - Gets executed when the UI is drawn. Custom gradio elements and their - corresponding event handlers should be defined here. + Gets executed when the UI is drawn. Custom gradio elements and + their corresponding event handlers should be defined here. + + To learn about gradio components, check out the docs: + https://gradio.app/docs/ """ pass From a9e10753df1df2a12e7304f5fc70b7435621a403 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 26 Jul 2023 07:59:40 -0700 Subject: [PATCH 3/7] Add missing \n to llama-v2 template context --- characters/instruction-following/Llama-v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/characters/instruction-following/Llama-v2.yaml b/characters/instruction-following/Llama-v2.yaml index a3af0e87a3..d259dd391a 100644 --- a/characters/instruction-following/Llama-v2.yaml +++ b/characters/instruction-following/Llama-v2.yaml @@ -1,4 +1,4 @@ user: "" bot: "" turn_template: "<|user|><|user-message|> [/INST] <|bot|><|bot-message|> [INST] " -context: "[INST] <>\nAnswer the questions.\n<>\n" +context: "[INST] <>\nAnswer the questions.\n<>\n\n" From ec68d5211ed7e846cbc24994e6d16932b34b7634 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:23:24 -0700 Subject: [PATCH 4/7] Set rms_norm_eps to 5e-6 for every llama-2 ggml model, not just 70b --- models/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/config.yaml b/models/config.yaml index 7343a0b12d..f9d0a4c03b 100644 --- a/models/config.yaml +++ b/models/config.yaml @@ -274,9 +274,9 @@ TheBloke_WizardLM-30B-GPTQ: instruction_template: 'Alpaca' .*llama-(2|v2): truncation_length: 4096 + rms_norm_eps: 5.0e-6 .*llama-(2|v2).*chat: mode: 'instruct' instruction_template: 'Llama-v2' .*llama.*70b.*ggml.*\.bin: n_gqa: 8 - rms_norm_eps: 5.0e-6 From f24f87cfb0cdbdeca9e09b08c03351910097be7f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 26 Jul 2023 09:37:48 -0700 Subject: [PATCH 5/7] Change a comment --- docs/Extensions.md | 2 +- extensions/example/script.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Extensions.md b/docs/Extensions.md index 74189efd9e..c7d1aa36a0 100644 --- a/docs/Extensions.md +++ b/docs/Extensions.md @@ -128,7 +128,7 @@ params = { class MyLogits(LogitsProcessor): """ Manipulates the probabilities for the next token before it gets sampled. - Used in the custom_logits_processor function below. + Used in the logits_processor_modifier function below. """ def __init__(self): pass diff --git a/extensions/example/script.py b/extensions/example/script.py index f81a652b26..669749c06f 100644 --- a/extensions/example/script.py +++ b/extensions/example/script.py @@ -24,7 +24,7 @@ class MyLogits(LogitsProcessor): """ Manipulates the probabilities for the next token before it gets sampled. - Used in the custom_logits_processor function below. + Used in the logits_processor_modifier function below. """ def __init__(self): pass From 4b37a2b39708d3ef4e8c900c6807d7a0b34a6454 Mon Sep 17 00:00:00 2001 From: GuizzyQC <86683381+GuizzyQC@users.noreply.github.com> Date: Wed, 26 Jul 2023 12:49:46 -0400 Subject: [PATCH 6/7] sd_api_pictures: Widen sliders for image size minimum and maximum (#3326) --- extensions/sd_api_pictures/script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/sd_api_pictures/script.py b/extensions/sd_api_pictures/script.py index 78488cd022..88a0d940dc 100644 --- a/extensions/sd_api_pictures/script.py +++ b/extensions/sd_api_pictures/script.py @@ -332,8 +332,8 @@ def ui(): negative_prompt = gr.Textbox(placeholder=params['negative_prompt'], value=params['negative_prompt'], label='Negative Prompt') with gr.Row(): with gr.Column(): - width = gr.Slider(256, 768, value=params['width'], step=64, label='Width') - height = gr.Slider(256, 768, value=params['height'], step=64, label='Height') + width = gr.Slider(64, 2048, value=params['width'], step=64, label='Width') + height = gr.Slider(64, 2048, value=params['height'], step=64, label='Height') with gr.Column(variant="compact", elem_id="sampler_col"): with gr.Row(elem_id="sampler_row"): sampler_name = gr.Dropdown(value=params['sampler_name'], label='Sampling method', elem_id="sampler_box") From ca4188aabc6e03b2a4cc2d06638a9f8aa52dd67b Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 29 Jul 2023 18:57:22 -0700 Subject: [PATCH 7/7] Update the example extension --- docs/Extensions.md | 6 ++++-- extensions/example/script.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/Extensions.md b/docs/Extensions.md index c7d1aa36a0..4e59e855e6 100644 --- a/docs/Extensions.md +++ b/docs/Extensions.md @@ -111,14 +111,16 @@ functions are declared in the same order that they are called at generation time. """ +import gradio as gr import torch -from modules import chat +from transformers import LogitsProcessor + +from modules import chat, shared from modules.text_generation import ( decode, encode, generate_reply, ) -from transformers import LogitsProcessor params = { "display_name": "Example Extension", diff --git a/extensions/example/script.py b/extensions/example/script.py index 669749c06f..b4db7102f7 100644 --- a/extensions/example/script.py +++ b/extensions/example/script.py @@ -7,14 +7,16 @@ generation time. """ +import gradio as gr import torch -from modules import chat +from transformers import LogitsProcessor + +from modules import chat, shared from modules.text_generation import ( decode, encode, generate_reply, ) -from transformers import LogitsProcessor params = { "display_name": "Example Extension",