[webui] upgrade to gradio 5 (#6688)

Former-commit-id: 9df7721264ddef0008d7648e6ed173adef99bd74
This commit is contained in:
hoshi-hiyouga
2025-01-17 20:15:42 +08:00
committed by GitHub
parent 33525a34b6
commit 31daa6570b
8 changed files with 36 additions and 44 deletions

View File

@@ -33,7 +33,7 @@ def create_chat_box(
engine: "Engine", visible: bool = False
) -> Tuple["Component", "Component", Dict[str, "Component"]]:
with gr.Column(visible=visible) as chat_box:
chatbot = gr.Chatbot(show_copy_button=True)
chatbot = gr.Chatbot(type="messages", show_copy_button=True)
messages = gr.State([])
with gr.Row():
with gr.Column(scale=4):

View File

@@ -30,11 +30,10 @@ if TYPE_CHECKING:
def create_top() -> Dict[str, "Component"]:
available_models = list(SUPPORTED_MODELS.keys()) + ["Custom"]
with gr.Row():
lang = gr.Dropdown(choices=["en", "ru", "zh", "ko"], scale=1)
model_name = gr.Dropdown(choices=available_models, scale=3)
lang = gr.Dropdown(choices=["en", "ru", "zh", "ko"], value=None, scale=1)
available_models = list(SUPPORTED_MODELS.keys()) + ["Custom"]
model_name = gr.Dropdown(choices=available_models, value=None, scale=3)
model_path = gr.Textbox(scale=3)
with gr.Row():

View File

@@ -39,9 +39,8 @@ def create_train_tab(engine: "Engine") -> Dict[str, "Component"]:
elem_dict = dict()
with gr.Row():
training_stage = gr.Dropdown(
choices=list(TRAINING_STAGES.keys()), value=list(TRAINING_STAGES.keys())[0], scale=1
)
stages = list(TRAINING_STAGES.keys())
training_stage = gr.Dropdown(choices=stages, value=stages[0], scale=1)
dataset_dir = gr.Textbox(value=DEFAULT_DATA_DIR, scale=1)
dataset = gr.Dropdown(multiselect=True, allow_custom_value=True, scale=4)
preview_elems = create_preview_box(dataset_dir, dataset)
@@ -107,8 +106,12 @@ def create_train_tab(engine: "Engine") -> Dict[str, "Component"]:
use_llama_pro = gr.Checkbox()
with gr.Column():
shift_attn = gr.Checkbox()
report_to = gr.Checkbox()
report_to = gr.Dropdown(
choices=["none", "all", "wandb", "mlflow", "neptune", "tensorboard"],
value=["none"],
allow_custom_value=True,
multiselect=True,
)
input_elems.update(
{
@@ -123,7 +126,6 @@ def create_train_tab(engine: "Engine") -> Dict[str, "Component"]:
mask_history,
resize_vocab,
use_llama_pro,
shift_attn,
report_to,
}
)
@@ -141,7 +143,6 @@ def create_train_tab(engine: "Engine") -> Dict[str, "Component"]:
mask_history=mask_history,
resize_vocab=resize_vocab,
use_llama_pro=use_llama_pro,
shift_attn=shift_attn,
report_to=report_to,
)
)