This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add SUPPORTED_MODEL_LIST * 1. save and reload model config edited by user 2. add predefined model configs 3. remove use_v2 config 4. add quantization config 5. simplify model configuration operations 6. fix plot bugs
- Loading branch information
Showing
14 changed files
with
185 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from glmtuner.webui.components.model import create_model_tab | ||
from glmtuner.webui.components.sft import create_sft_tab | ||
from glmtuner.webui.components.eval import create_eval_tab | ||
from glmtuner.webui.components.infer import create_infer_tab | ||
from glmtuner.webui.components.model import create_model_tab | ||
from glmtuner.webui.components.sft import create_sft_tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import gradio as gr | ||
from typing import Tuple | ||
|
||
import gradio as gr | ||
from gradio.components import Component | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,30 @@ | ||
import gradio as gr | ||
from typing import Tuple | ||
from gradio.components import Component | ||
|
||
from glmtuner.webui.common import add_model, del_model, list_models, list_checkpoints | ||
|
||
|
||
def create_model_manager(base_model: Component, model_list: Component) -> Component: | ||
with gr.Box(visible=False, elem_classes="modal-box") as model_manager: | ||
model_name = gr.Textbox(lines=1, label="Model name") | ||
model_path = gr.Textbox(lines=1, label="Model path", info="The absolute path to your model.") | ||
|
||
with gr.Row(): | ||
confirm = gr.Button("Save") | ||
cancel = gr.Button("Cancel") | ||
|
||
confirm.click( | ||
add_model, [model_list, model_name, model_path], [model_list, model_name, model_path] | ||
).then( | ||
lambda: gr.update(visible=False), outputs=[model_manager] | ||
).then( | ||
list_models, [model_list], [base_model] | ||
) | ||
|
||
cancel.click(lambda: gr.update(visible=False), outputs=[model_manager]) | ||
import gradio as gr | ||
from gradio.components import Component | ||
|
||
return model_manager | ||
from glmtuner.extras.constants import SUPPORTED_MODEL_LIST | ||
from glmtuner.webui.common import list_checkpoints, load_temp_use_config, save_model_config | ||
|
||
|
||
def create_model_tab() -> Tuple[Component, Component, Component]: | ||
|
||
model_list = gr.State([]) # gr.State does not accept a dict | ||
user_config = load_temp_use_config() | ||
gr_state = gr.State([]) # gr.State does not accept a dict | ||
|
||
with gr.Row(): | ||
base_model = gr.Dropdown(label="Model", interactive=True, scale=4) | ||
add_btn = gr.Button("Add model", scale=1) | ||
del_btn = gr.Button("Delete model", scale=1) | ||
model_name = gr.Dropdown([model["pretrained_model_name"] for model in SUPPORTED_MODEL_LIST] + ["custom"], | ||
label="Base Model", info="Model Version of ChatGLM", | ||
value=user_config.get("model_name")) | ||
model_path = gr.Textbox(lines=1, label="Local model path(Optional)", | ||
info="The absolute path of the directory where the local model file is located", | ||
value=user_config.get("model_path")) | ||
|
||
with gr.Row(): | ||
checkpoints = gr.Dropdown(label="Checkpoints", multiselect=True, interactive=True, scale=5) | ||
refresh = gr.Button("Refresh checkpoints", scale=1) | ||
|
||
model_manager = create_model_manager(base_model, model_list) | ||
|
||
base_model.change(list_checkpoints, [base_model], [checkpoints]) | ||
|
||
add_btn.click(lambda: gr.update(visible=True), outputs=[model_manager]).then( | ||
list_models, [model_list], [base_model] | ||
) | ||
|
||
del_btn.click(del_model, [model_list, base_model], [model_list]).then( | ||
list_models, [model_list], [base_model] | ||
) | ||
|
||
refresh.click(list_checkpoints, [base_model], [checkpoints]) | ||
model_name.change(list_checkpoints, [model_name], [checkpoints]) | ||
model_path.change(save_model_config, [model_name, model_path]) | ||
refresh.click(list_checkpoints, [model_name], [checkpoints]) | ||
|
||
return base_model, model_list, checkpoints | ||
return model_name, model_path, checkpoints |
Oops, something went wrong.