mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-01-27 20:43:19 +01:00
Merge branch 'oobabooga:main' into multi_user
This commit is contained in:
commit
e1c5d350b1
@ -48,12 +48,14 @@
|
||||
.chat .user-message {
|
||||
background: #f4f4f4;
|
||||
padding: 1.5rem 1rem;
|
||||
padding-bottom: 2rem;
|
||||
border-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.chat .assistant-message {
|
||||
padding: 1.5rem 1rem;
|
||||
padding-bottom: 2rem;
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
62
css/main.css
62
css/main.css
@ -1142,7 +1142,6 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
||||
}
|
||||
|
||||
.dark svg {
|
||||
fill: white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@ -1221,3 +1220,64 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
||||
background: var(--light-theme-gray);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------
|
||||
Copy button for chat messages
|
||||
---------------------------------------------- */
|
||||
.message .text,
|
||||
.message .text-you,
|
||||
.message .text-bot,
|
||||
.user-message .text,
|
||||
.assistant-message .text {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.message, .user-message, .assistant-message {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.footer-button {
|
||||
position: absolute;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.footer-button.footer-copy-button {
|
||||
bottom: -23px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.footer-button.footer-refresh-button {
|
||||
bottom: -23px;
|
||||
left: 25px;
|
||||
}
|
||||
|
||||
.message:hover .footer-button,
|
||||
.user-message:hover .footer-button,
|
||||
.assistant-message:hover .footer-button {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.footer-button svg {
|
||||
stroke: rgb(156 163 175);
|
||||
transition: stroke 0.2s;
|
||||
}
|
||||
|
||||
.footer-button:hover svg {
|
||||
stroke: rgb(107 114 128);
|
||||
}
|
||||
|
||||
.dark .footer-button svg {
|
||||
stroke: rgb(156 163 175);
|
||||
}
|
||||
|
||||
.dark .footer-button:hover svg {
|
||||
stroke: rgb(209 213 219);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import gradio as gr
|
||||
from modules.html_generator import get_image_cache
|
||||
from modules.shared import gradio
|
||||
|
||||
|
||||
params = {
|
||||
'items_per_page': 50,
|
||||
'open': False,
|
||||
@ -93,10 +92,11 @@ def generate_html():
|
||||
|
||||
def filter_cards(filter_str=''):
|
||||
if filter_str == '':
|
||||
return cards
|
||||
return gr.Dataset(samples=cards)
|
||||
|
||||
filter_upper = filter_str.upper()
|
||||
return [k for k in cards if filter_upper in k[1].upper()]
|
||||
filtered = [k for k in cards if filter_upper in k[1].upper()]
|
||||
return gr.Dataset(samples=filtered)
|
||||
|
||||
|
||||
def select_character(evt: gr.SelectData):
|
||||
|
46
js/global_scope_js.js
Normal file
46
js/global_scope_js.js
Normal file
@ -0,0 +1,46 @@
|
||||
function copyToClipboard(element) {
|
||||
if (!element) return;
|
||||
|
||||
const messageElement = element.closest(".message, .user-message, .assistant-message");
|
||||
if (!messageElement) return;
|
||||
|
||||
const rawText = messageElement.getAttribute("data-raw");
|
||||
if (!rawText) return;
|
||||
|
||||
navigator.clipboard.writeText(rawText).then(function() {
|
||||
const originalSvg = element.innerHTML;
|
||||
element.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"text-green-500 dark:text-green-400\"><path d=\"M5 12l5 5l10 -10\"></path></svg>";
|
||||
setTimeout(() => {
|
||||
element.innerHTML = originalSvg;
|
||||
}, 1000);
|
||||
}).catch(function(err) {
|
||||
console.error("Failed to copy text: ", err);
|
||||
});
|
||||
}
|
||||
|
||||
function regenerateClick() {
|
||||
document.getElementById("Regenerate").click();
|
||||
}
|
||||
|
||||
function handleMorphdomUpdate(text) {
|
||||
morphdom(
|
||||
document.getElementById("chat").parentNode,
|
||||
"<div class=\"prose svelte-1ybaih5\">" + text + "</div>",
|
||||
{
|
||||
onBeforeElUpdated: function(fromEl, toEl) {
|
||||
if (fromEl.tagName === "PRE" && fromEl.querySelector("code[data-highlighted]")) {
|
||||
const fromCode = fromEl.querySelector("code");
|
||||
const toCode = toEl.querySelector("code");
|
||||
|
||||
if (fromCode && toCode && fromCode.textContent === toCode.textContent) {
|
||||
// If the <code> content is the same, preserve the entire <pre> element
|
||||
toEl.className = fromEl.className;
|
||||
toEl.innerHTML = fromEl.innerHTML;
|
||||
return false; // Skip updating the <pre> element
|
||||
}
|
||||
}
|
||||
return !fromEl.isEqualNode(toEl); // Update only if nodes differ
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
58
js/main.js
58
js/main.js
@ -147,10 +147,9 @@ const observer = new MutationObserver(function(mutations) {
|
||||
|
||||
doSyntaxHighlighting();
|
||||
|
||||
if(!isScrolled) {
|
||||
if (!isScrolled && targetElement.scrollTop !== targetElement.scrollHeight) {
|
||||
targetElement.scrollTop = targetElement.scrollHeight;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Configure the observer to watch for changes in the subtree and attributes
|
||||
@ -178,47 +177,30 @@ function isElementVisibleOnScreen(element) {
|
||||
);
|
||||
}
|
||||
|
||||
function getVisibleMessagesIndexes() {
|
||||
const elements = document.querySelectorAll(".message-body");
|
||||
const visibleIndexes = [];
|
||||
|
||||
elements.forEach((element, index) => {
|
||||
if (isElementVisibleOnScreen(element) && !element.hasAttribute("data-highlighted")) {
|
||||
visibleIndexes.push(index);
|
||||
}
|
||||
});
|
||||
|
||||
return visibleIndexes;
|
||||
}
|
||||
|
||||
function doSyntaxHighlighting() {
|
||||
const indexes = getVisibleMessagesIndexes();
|
||||
const elements = document.querySelectorAll(".message-body");
|
||||
const messageBodies = document.querySelectorAll(".message-body");
|
||||
|
||||
if (indexes.length > 0) {
|
||||
if (messageBodies.length > 0) {
|
||||
observer.disconnect();
|
||||
|
||||
indexes.forEach((index) => {
|
||||
const element = elements[index];
|
||||
messageBodies.forEach((messageBody) => {
|
||||
if (isElementVisibleOnScreen(messageBody)) {
|
||||
// Handle both code and math in a single pass through each message
|
||||
const codeBlocks = messageBody.querySelectorAll("pre code:not([data-highlighted])");
|
||||
codeBlocks.forEach((codeBlock) => {
|
||||
hljs.highlightElement(codeBlock);
|
||||
codeBlock.setAttribute("data-highlighted", "true");
|
||||
});
|
||||
|
||||
// Tag this element to prevent it from being highlighted twice
|
||||
element.setAttribute("data-highlighted", "true");
|
||||
|
||||
// Perform syntax highlighting
|
||||
const codeBlocks = element.querySelectorAll("pre code");
|
||||
|
||||
codeBlocks.forEach((codeBlock) => {
|
||||
hljs.highlightElement(codeBlock);
|
||||
});
|
||||
|
||||
renderMathInElement(element, {
|
||||
delimiters: [
|
||||
{ left: "$$", right: "$$", display: true },
|
||||
{ left: "$", right: "$", display: false },
|
||||
{ left: "\\(", right: "\\)", display: false },
|
||||
{ left: "\\[", right: "\\]", display: true },
|
||||
],
|
||||
});
|
||||
renderMathInElement(messageBody, {
|
||||
delimiters: [
|
||||
{ left: "$$", right: "$$", display: true },
|
||||
{ left: "$", right: "$", display: false },
|
||||
{ left: "\\(", right: "\\)", display: false },
|
||||
{ left: "\\[", right: "\\]", display: true },
|
||||
],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(targetElement, config);
|
||||
|
1
js/morphdom/morphdom-umd.min.js
vendored
Normal file
1
js/morphdom/morphdom-umd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@ import io
|
||||
|
||||
import requests
|
||||
|
||||
from modules import shared
|
||||
from modules import shared, ui
|
||||
from modules.logging_colors import logger
|
||||
|
||||
original_open = open
|
||||
@ -55,8 +55,10 @@ def my_open(*args, **kwargs):
|
||||
'\n <script src="file/js/katex/auto-render.min.js"></script>'
|
||||
'\n <script src="file/js/highlightjs/highlight.min.js"></script>'
|
||||
'\n <script src="file/js/highlightjs/highlightjs-copy.min.js"></script>'
|
||||
'\n <script src="file/js/morphdom/morphdom-umd.min.js"></script>'
|
||||
f'\n <link id="highlight-css" rel="stylesheet" href="file/css/highlightjs/{"github-dark" if shared.settings["dark_theme"] else "github"}.min.css">'
|
||||
'\n <script>hljs.addPlugin(new CopyButtonPlugin());</script>'
|
||||
f'\n <script>{ui.global_scope_js}</script>'
|
||||
'\n </head>'
|
||||
)
|
||||
|
||||
|
@ -73,7 +73,6 @@ def fix_newlines(string):
|
||||
|
||||
|
||||
def replace_quotes(text):
|
||||
|
||||
# Define a list of quote pairs (opening and closing), using HTML entities
|
||||
quote_pairs = [
|
||||
('"', '"'), # Double quotes
|
||||
@ -84,14 +83,22 @@ def replace_quotes(text):
|
||||
('‘', '’'), # Alternative single quotes
|
||||
('“', '”'), # Unicode quotes (numeric entities)
|
||||
('“', '”'), # Unicode quotes (hex entities)
|
||||
('\u201C', '\u201D'), # Unicode quotes (literal chars)
|
||||
]
|
||||
|
||||
# Create a regex pattern that matches any of the quote pairs, including newlines
|
||||
pattern = '|'.join(f'({re.escape(open_q)})(.*?)({re.escape(close_q)})' for open_q, close_q in quote_pairs)
|
||||
|
||||
# Replace matched patterns with <q> tags, keeping original quotes
|
||||
replaced_text = re.sub(pattern, lambda m: f'<q>{m.group(1)}{m.group(2)}{m.group(3)}</q>', text, flags=re.DOTALL)
|
||||
def replacer(m):
|
||||
# Find the first non-None group set
|
||||
for i in range(1, len(m.groups()), 3): # Step through each sub-pattern's groups
|
||||
if m.group(i): # If this sub-pattern matched
|
||||
return f'<q>{m.group(i)}{m.group(i + 1)}{m.group(i + 2)}</q>'
|
||||
|
||||
return m.group(0) # Fallback (shouldn't happen)
|
||||
|
||||
replaced_text = re.sub(pattern, replacer, text, flags=re.DOTALL)
|
||||
return replaced_text
|
||||
|
||||
|
||||
@ -239,6 +246,9 @@ def convert_to_markdown(string):
|
||||
pattern = re.compile(r'<code[^>]*>(.*?)</code>', re.DOTALL)
|
||||
html_output = pattern.sub(lambda x: html.unescape(x.group()), html_output)
|
||||
|
||||
# Unescape backslashes
|
||||
html_output = html_output.replace('\\\\', '\\')
|
||||
|
||||
# Add "long-list" class to <ul> or <ol> containing a long <li> item
|
||||
html_output = add_long_list_class(html_output)
|
||||
|
||||
@ -292,24 +302,38 @@ def get_image_cache(path):
|
||||
return image_cache[path][1]
|
||||
|
||||
|
||||
copy_svg = '''<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-copy"><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg>'''
|
||||
refresh_svg = '''<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-repeat"><path d="M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3"></path><path d="M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3"></path></svg>'''
|
||||
copy_button = f'<button class="footer-button footer-copy-button" onclick="copyToClipboard(this)">{copy_svg}</button>'
|
||||
refresh_button = f'<button class="footer-button footer-refresh-button" onclick="regenerateClick()">{refresh_svg}</button>'
|
||||
|
||||
|
||||
def generate_instruct_html(history):
|
||||
output = f'<style>{instruct_css}</style><div class="chat" id="chat"><div class="messages">'
|
||||
for i, _row in enumerate(history):
|
||||
row = [convert_to_markdown_wrapped(entry, use_cache=i != len(history) - 1) for entry in _row]
|
||||
|
||||
if row[0]: # Don't display empty user messages
|
||||
for i in range(len(history['visible'])):
|
||||
row_visible = history['visible'][i]
|
||||
row_internal = history['internal'][i]
|
||||
converted_visible = [convert_to_markdown_wrapped(entry, use_cache=i != len(history['visible']) - 1) for entry in row_visible]
|
||||
|
||||
if converted_visible[0]: # Don't display empty user messages
|
||||
output += (
|
||||
f'<div class="user-message">'
|
||||
f'<div class="user-message" '
|
||||
f'data-raw="{html.escape(row_internal[0], quote=True)}">'
|
||||
f'<div class="text">'
|
||||
f'<div class="message-body">{row[0]}</div>'
|
||||
f'<div class="message-body">{converted_visible[0]}</div>'
|
||||
f'{copy_button}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
|
||||
output += (
|
||||
f'<div class="assistant-message">'
|
||||
f'<div class="assistant-message" '
|
||||
f'data-raw="{html.escape(row_internal[1], quote=True)}">'
|
||||
f'<div class="text">'
|
||||
f'<div class="message-body">{row[1]}</div>'
|
||||
f'<div class="message-body">{converted_visible[1]}</div>'
|
||||
f'{copy_button}'
|
||||
f'{refresh_button if i == len(history["visible"]) - 1 else ""}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
@ -332,26 +356,33 @@ def generate_cai_chat_html(history, name1, name2, style, character, reset_cache=
|
||||
if Path("cache/pfp_me.png").exists() else ''
|
||||
)
|
||||
|
||||
for i, _row in enumerate(history):
|
||||
row = [convert_to_markdown_wrapped(entry, use_cache=i != len(history) - 1) for entry in _row]
|
||||
for i in range(len(history['visible'])):
|
||||
row_visible = history['visible'][i]
|
||||
row_internal = history['internal'][i]
|
||||
converted_visible = [convert_to_markdown_wrapped(entry, use_cache=i != len(history['visible']) - 1) for entry in row_visible]
|
||||
|
||||
if row[0]: # Don't display empty user messages
|
||||
if converted_visible[0]: # Don't display empty user messages
|
||||
output += (
|
||||
f'<div class="message">'
|
||||
f'<div class="message" '
|
||||
f'data-raw="{html.escape(row_internal[0], quote=True)}">'
|
||||
f'<div class="circle-you">{img_me}</div>'
|
||||
f'<div class="text">'
|
||||
f'<div class="username">{name1}</div>'
|
||||
f'<div class="message-body">{row[0]}</div>'
|
||||
f'<div class="message-body">{converted_visible[0]}</div>'
|
||||
f'{copy_button}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
|
||||
output += (
|
||||
f'<div class="message">'
|
||||
f'<div class="message" '
|
||||
f'data-raw="{html.escape(row_internal[1], quote=True)}">'
|
||||
f'<div class="circle-bot">{img_bot}</div>'
|
||||
f'<div class="text">'
|
||||
f'<div class="username">{name2}</div>'
|
||||
f'<div class="message-body">{row[1]}</div>'
|
||||
f'<div class="message-body">{converted_visible[1]}</div>'
|
||||
f'{copy_button}'
|
||||
f'{refresh_button if i == len(history["visible"]) - 1 else ""}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
@ -363,22 +394,29 @@ def generate_cai_chat_html(history, name1, name2, style, character, reset_cache=
|
||||
def generate_chat_html(history, name1, name2, reset_cache=False):
|
||||
output = f'<style>{chat_styles["wpp"]}</style><div class="chat" id="chat"><div class="messages">'
|
||||
|
||||
for i, _row in enumerate(history):
|
||||
row = [convert_to_markdown_wrapped(entry, use_cache=i != len(history) - 1) for entry in _row]
|
||||
for i in range(len(history['visible'])):
|
||||
row_visible = history['visible'][i]
|
||||
row_internal = history['internal'][i]
|
||||
converted_visible = [convert_to_markdown_wrapped(entry, use_cache=i != len(history['visible']) - 1) for entry in row_visible]
|
||||
|
||||
if row[0]: # Don't display empty user messages
|
||||
if converted_visible[0]: # Don't display empty user messages
|
||||
output += (
|
||||
f'<div class="message">'
|
||||
f'<div class="message" '
|
||||
f'data-raw="{html.escape(row_internal[0], quote=True)}">'
|
||||
f'<div class="text-you">'
|
||||
f'<div class="message-body">{row[0]}</div>'
|
||||
f'<div class="message-body">{converted_visible[0]}</div>'
|
||||
f'{copy_button}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
|
||||
output += (
|
||||
f'<div class="message">'
|
||||
f'<div class="message" '
|
||||
f'data-raw="{html.escape(row_internal[1], quote=True)}">'
|
||||
f'<div class="text-bot">'
|
||||
f'<div class="message-body">{row[1]}</div>'
|
||||
f'<div class="message-body">{converted_visible[1]}</div>'
|
||||
f'{copy_button}'
|
||||
f'{refresh_button if i == len(history["visible"]) - 1 else ""}'
|
||||
f'</div>'
|
||||
f'</div>'
|
||||
)
|
||||
@ -389,8 +427,8 @@ def generate_chat_html(history, name1, name2, reset_cache=False):
|
||||
|
||||
def chat_html_wrapper(history, name1, name2, mode, style, character, reset_cache=False):
|
||||
if mode == 'instruct':
|
||||
return generate_instruct_html(history['visible'])
|
||||
return generate_instruct_html(history)
|
||||
elif style == 'wpp':
|
||||
return generate_chat_html(history['visible'], name1, name2)
|
||||
return generate_chat_html(history, name1, name2)
|
||||
else:
|
||||
return generate_cai_chat_html(history['visible'], name1, name2, style, character, reset_cache)
|
||||
return generate_cai_chat_html(history, name1, name2, style, character, reset_cache)
|
||||
|
@ -48,7 +48,7 @@ settings = {
|
||||
'prompt_lookup_num_tokens': 0,
|
||||
'max_tokens_second': 0,
|
||||
'max_updates_second': 0,
|
||||
'auto_max_new_tokens': False,
|
||||
'auto_max_new_tokens': True,
|
||||
'ban_eos_token': False,
|
||||
'add_bos_token': True,
|
||||
'skip_special_tokens': True,
|
||||
|
@ -19,6 +19,8 @@ with open(Path(__file__).resolve().parent / '../css/highlightjs/highlightjs-copy
|
||||
css += f.read()
|
||||
with open(Path(__file__).resolve().parent / '../js/main.js', 'r') as f:
|
||||
js = f.read()
|
||||
with open(Path(__file__).resolve().parent / '../js/global_scope_js.js', 'r') as f:
|
||||
global_scope_js = f.read()
|
||||
with open(Path(__file__).resolve().parent / '../js/save_files.js', 'r') as f:
|
||||
save_files_js = f.read()
|
||||
with open(Path(__file__).resolve().parent / '../js/switch_tabs.js', 'r') as f:
|
||||
|
@ -20,7 +20,7 @@ def create_ui():
|
||||
shared.gradio['Chat input'] = gr.State()
|
||||
shared.gradio['history'] = gr.JSON(visible=False)
|
||||
|
||||
with gr.Tab('Chat', elem_id='chat-tab'):
|
||||
with gr.Tab('Chat', id='Chat', elem_id='chat-tab'):
|
||||
with gr.Row(elem_id='past-chats-row', elem_classes=['pretty_scrollbar']):
|
||||
with gr.Column():
|
||||
with gr.Row(elem_id='past-chats-buttons'):
|
||||
@ -46,8 +46,8 @@ def create_ui():
|
||||
|
||||
with gr.Row():
|
||||
with gr.Column(elem_id='chat-col'):
|
||||
shared.gradio['display'] = gr.HTML(value=chat_html_wrapper({'internal': [], 'visible': []}, '', '', 'chat', 'cai-chat', ''))
|
||||
|
||||
shared.gradio['html_display'] = gr.HTML(value=chat_html_wrapper({'internal': [], 'visible': []}, '', '', 'chat', 'cai-chat', ''), visible=True)
|
||||
shared.gradio['display'] = gr.Textbox(value="", visible=False) # Hidden buffer
|
||||
with gr.Row(elem_id="chat-input-row"):
|
||||
with gr.Column(scale=1, elem_id='gr-hover-container'):
|
||||
gr.HTML(value='<div class="hover-element" onclick="void(0)"><span style="width: 100px; display: block" id="hover-element-button">☰</span><div class="hover-menu" id="hover-menu"></div>', elem_id='gr-hover')
|
||||
@ -170,7 +170,7 @@ def create_chat_settings_ui():
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
shared.gradio['custom_system_message'] = gr.Textbox(value=shared.settings['custom_system_message'], lines=2, label='Custom system message', info='If not empty, will be used instead of the default one.', elem_classes=['add_scrollbar'])
|
||||
shared.gradio['instruction_template_str'] = gr.Textbox(value='', label='Instruction template', lines=24, info='Change this according to the model/LoRA that you are using. Used in instruct and chat-instruct modes.', elem_classes=['add_scrollbar', 'monospace'])
|
||||
shared.gradio['instruction_template_str'] = gr.Textbox(value='', label='Instruction template', lines=24, info='This gets autodetected; you usually don\'t need to change it. Used in instruct and chat-instruct modes.', elem_classes=['add_scrollbar', 'monospace'])
|
||||
with gr.Row():
|
||||
shared.gradio['send_instruction_to_default'] = gr.Button('Send to default', elem_classes=['small-button'])
|
||||
shared.gradio['send_instruction_to_notebook'] = gr.Button('Send to notebook', elem_classes=['small-button'])
|
||||
@ -186,6 +186,9 @@ def create_event_handlers():
|
||||
shared.input_params = gradio(inputs)
|
||||
shared.reload_inputs = gradio(reload_arr)
|
||||
|
||||
# Morph HTML updates instead of updating everything
|
||||
shared.gradio['display'].change(None, gradio('display'), None, js="(text) => handleMorphdomUpdate(text)")
|
||||
|
||||
shared.gradio['Generate'].click(
|
||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||
lambda x: (x, ''), gradio('textbox'), gradio('Chat input', 'textbox'), show_progress=False).then(
|
||||
|
@ -55,7 +55,7 @@ https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+cu121.torch2.4.1-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+cu121.torch2.4.1-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7-py3-none-any.whl; platform_system == "Linux" and platform_machine != "x86_64"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu122torch2.4.1cxx11abiFALSE-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu122torch2.4.1cxx11abiFALSE-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu122torch2.4.1cxx11abiFALSE-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu122torch2.4.1cxx11abiFALSE-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
|
@ -55,7 +55,7 @@ https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+cu121.torch2.4.1-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7+cu121.torch2.4.1-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
https://github.com/oobabooga/exllamav2/releases/download/v0.2.7/exllamav2-0.2.7-py3-none-any.whl; platform_system == "Linux" and platform_machine != "x86_64"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu122torch2.4.1cxx11abiFALSE-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu122torch2.4.1cxx11abiFALSE-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu122torch2.4.1cxx11abiFALSE-cp311-cp311-win_amd64.whl; platform_system == "Windows" and python_version == "3.11"
|
||||
https://github.com/oobabooga/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu122torch2.4.1cxx11abiFALSE-cp310-cp310-win_amd64.whl; platform_system == "Windows" and python_version == "3.10"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.11"
|
||||
https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl; platform_system == "Linux" and platform_machine == "x86_64" and python_version == "3.10"
|
||||
|
@ -19,7 +19,7 @@ max_new_tokens_max: 4096
|
||||
prompt_lookup_num_tokens: 0
|
||||
max_tokens_second: 0
|
||||
max_updates_second: 0
|
||||
auto_max_new_tokens: false
|
||||
auto_max_new_tokens: true
|
||||
ban_eos_token: false
|
||||
add_bos_token: true
|
||||
skip_special_tokens: true
|
||||
|
@ -23,4 +23,4 @@ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains a
|
||||
conda activate "$INSTALL_ENV_DIR"
|
||||
|
||||
# update installer env
|
||||
python one_click.py --update-wizard && echo -e "\nDone!"
|
||||
python one_click.py --update-wizard && echo -e "\nHave a great day!"
|
||||
|
@ -23,4 +23,4 @@ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains a
|
||||
conda activate "$INSTALL_ENV_DIR"
|
||||
|
||||
# update installer env
|
||||
python one_click.py --update-wizard && echo -e "\nDone!"
|
||||
python one_click.py --update-wizard && echo -e "\nHave a great day!"
|
||||
|
@ -30,7 +30,7 @@ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || (
|
||||
@rem update installer env
|
||||
call python one_click.py --update-wizard && (
|
||||
echo.
|
||||
echo Done!
|
||||
echo Have a great day!
|
||||
)
|
||||
|
||||
:end
|
||||
|
Loading…
Reference in New Issue
Block a user