Add grammar to llama.cpp loader (closes #4019)

This commit is contained in:
oobabooga 2023-09-24 07:08:41 -07:00
parent a3ad9fe6c0
commit b227e65d86
18 changed files with 162 additions and 0 deletions

View file

@ -108,6 +108,9 @@ def create_ui(default_preset):
shared.gradio['num_beams'] = gr.Slider(1, 20, step=1, value=generate_params['num_beams'], label='num_beams', info='For Beam Search, along with length_penalty and early_stopping.')
shared.gradio['length_penalty'] = gr.Slider(-5, 5, value=generate_params['length_penalty'], label='length_penalty')
shared.gradio['early_stopping'] = gr.Checkbox(value=generate_params['early_stopping'], label='early_stopping')
with gr.Row():
shared.gradio['grammar_file'] = gr.Dropdown(value='None', choices=utils.get_available_grammars(), label='Grammar file (GBNF)', elem_classes='slim-dropdown')
ui.create_refresh_button(shared.gradio['grammar_file'], lambda: None, lambda: {'choices': utils.get_available_grammars()}, 'refresh-button')
with gr.Box():
with gr.Row():