mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-12-17 12:20:37 +08:00
update api and support abort eval in webui
This commit is contained in:
@@ -48,6 +48,7 @@ def create_eval_tab(engine: "Engine") -> Dict[str, "Component"]:
|
||||
with gr.Row():
|
||||
cmd_preview_btn = gr.Button()
|
||||
start_btn = gr.Button(variant="primary")
|
||||
stop_btn = gr.Button(variant="stop")
|
||||
|
||||
with gr.Row():
|
||||
resume_btn = gr.Checkbox(visible=False, interactive=False)
|
||||
@@ -61,6 +62,7 @@ def create_eval_tab(engine: "Engine") -> Dict[str, "Component"]:
|
||||
dict(
|
||||
cmd_preview_btn=cmd_preview_btn,
|
||||
start_btn=start_btn,
|
||||
stop_btn=stop_btn,
|
||||
resume_btn=resume_btn,
|
||||
progress_bar=progress_bar,
|
||||
output_box=output_box,
|
||||
@@ -69,6 +71,7 @@ def create_eval_tab(engine: "Engine") -> Dict[str, "Component"]:
|
||||
|
||||
cmd_preview_btn.click(engine.runner.preview_eval, input_elems, output_elems, concurrency_limit=None)
|
||||
start_btn.click(engine.runner.run_eval, input_elems, output_elems)
|
||||
stop_btn.click(engine.runner.set_abort)
|
||||
resume_btn.change(engine.runner.monitor, outputs=output_elems, concurrency_limit=None)
|
||||
|
||||
dataset_dir.change(list_dataset, [dataset_dir], [dataset], queue=False)
|
||||
|
||||
@@ -68,9 +68,9 @@ def create_web_demo() -> gr.Blocks:
|
||||
return demo
|
||||
|
||||
|
||||
def run_web_ui():
|
||||
def run_web_ui() -> None:
|
||||
create_ui().queue().launch()
|
||||
|
||||
|
||||
def run_web_demo():
|
||||
def run_web_demo() -> None:
|
||||
create_web_demo().queue().launch()
|
||||
|
||||
@@ -1449,7 +1449,7 @@ ALERTS = {
|
||||
"info_aborting": {
|
||||
"en": "Aborted, wait for terminating...",
|
||||
"ru": "Прервано, ожидание завершения...",
|
||||
"zh": "训练中断,正在等待线程结束……",
|
||||
"zh": "训练中断,正在等待进程结束……",
|
||||
},
|
||||
"info_aborted": {
|
||||
"en": "Ready.",
|
||||
|
||||
Reference in New Issue
Block a user