Improve the UI tokenizer
This commit is contained in:
parent
c3e4c9fdc2
commit
ef04138bc0
4 changed files with 21 additions and 6 deletions
|
@ -3,8 +3,8 @@ import gradio as gr
|
|||
from modules import logits, shared, ui, utils
|
||||
from modules.prompts import count_tokens, load_prompt
|
||||
from modules.text_generation import (
|
||||
encode,
|
||||
generate_reply_wrapper,
|
||||
get_token_ids,
|
||||
stop_everything_event
|
||||
)
|
||||
from modules.utils import gradio
|
||||
|
@ -43,7 +43,7 @@ def create_ui():
|
|||
|
||||
with gr.Tab('Tokens'):
|
||||
shared.gradio['get_tokens-notebook'] = gr.Button('Get token IDs for the input')
|
||||
shared.gradio['tokens-notebook'] = gr.Textbox(lines=23, label='Tokens', elem_classes=['textbox_logits_notebook', 'add_scrollbar'])
|
||||
shared.gradio['tokens-notebook'] = gr.Textbox(lines=23, label='Tokens', elem_classes=['textbox_logits_notebook', 'add_scrollbar', 'monospace'])
|
||||
|
||||
with gr.Row():
|
||||
shared.gradio['Generate-notebook'] = gr.Button('Generate', variant='primary', elem_classes='small-button')
|
||||
|
@ -102,4 +102,4 @@ def create_event_handlers():
|
|||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||
logits.get_next_logits, gradio('textbox-notebook', 'interface_state', 'use_samplers-notebook', 'logits-notebook'), gradio('logits-notebook', 'logits-notebook-previous'), show_progress=False)
|
||||
|
||||
shared.gradio['get_tokens-notebook'].click(lambda x : str(encode(x)[0].tolist()), gradio('textbox-notebook'), gradio('tokens-notebook'), show_progress=False)
|
||||
shared.gradio['get_tokens-notebook'].click(get_token_ids, gradio('textbox-notebook'), gradio('tokens-notebook'), show_progress=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue