From f2425cb4ed5a8c59da7a864d303dcedc8758e3dd Mon Sep 17 00:00:00 2001 From: hiyouga <467089858@qq.com> Date: Thu, 27 Jun 2024 00:46:41 +0800 Subject: [PATCH] tiny fix Former-commit-id: f17c9dfd848ff8ee33fb4db70e40bca15153e40f --- src/llamafactory/webui/components/top.py | 2 +- src/llamafactory/webui/utils.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/llamafactory/webui/components/top.py b/src/llamafactory/webui/components/top.py index e331d5e4..9df3f062 100644 --- a/src/llamafactory/webui/components/top.py +++ b/src/llamafactory/webui/components/top.py @@ -43,7 +43,7 @@ def create_top() -> Dict[str, "Component"]: with gr.Accordion(open=False) as advanced_tab: with gr.Row(): - quantization_bit = gr.Dropdown(choices=["none", "8", "4"], value="none", scale=1) + quantization_bit = gr.Dropdown(choices=["none", "8", "4"], value="none", allow_custom_value=True, scale=1) quantization_method = gr.Dropdown(choices=["bitsandbytes", "hqq", "eetq"], value="bitsandbytes", scale=1) template = gr.Dropdown(choices=list(TEMPLATES.keys()), value="default", scale=1) rope_scaling = gr.Radio(choices=["none", "linear", "dynamic"], value="none", scale=2) diff --git a/src/llamafactory/webui/utils.py b/src/llamafactory/webui/utils.py index 069a2a2a..14616ac4 100644 --- a/src/llamafactory/webui/utils.py +++ b/src/llamafactory/webui/utils.py @@ -61,11 +61,13 @@ def can_quantize_to(quantization_method: str) -> "gr.Dropdown": Returns the available quantization bits. """ if quantization_method == QuantizationMethod.BITS_AND_BYTES.value: - return gr.Dropdown(choices=["none", "8", "4"], value="none") + available_bits = ["none", "8", "4"] elif quantization_method == QuantizationMethod.HQQ.value: - return gr.Dropdown(choices=["none", "8", "6", "5", "4", "3", "2", "1"], value="none") + available_bits = ["none", "8", "6", "5", "4", "3", "2", "1"] elif quantization_method == QuantizationMethod.EETQ.value: - return gr.Dropdown(choices=["none", "8"], value="none") + available_bits = ["none", "8"] + + return gr.Dropdown(choices=available_bits) def change_stage(training_stage: str = list(TRAINING_STAGES.keys())[0]) -> Tuple[List[str], bool]: