Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Hiyouga LLaMA Factory WebUI Top Component

From Leeroopedia


Knowledge Sources
Domains WebUI, Model Configuration, Gradio Components
Last Updated 2026-02-06 19:00 GMT

Overview

Top-level model selection and configuration panel that serves as the shared header across all WebUI tabs.

Description

The top.py module defines create_top, which builds the global configuration panel at the top of the WebUI. It includes dropdowns for language selection (en, ru, zh, ko, ja), model name (from SUPPORTED_MODELS plus "Custom"), model path textbox, hub selection (HuggingFace, ModelScope, OpenMind with auto-detection of default), finetuning type (from METHODS, default "lora"), checkpoint path (multiselect for PEFT methods), quantization settings (bit/method), template selection (from TEMPLATES), rope scaling mode, and booster option. The component wires extensive change/input events: model selection triggers path and template lookup plus checkpoint listing; finetuning type changes update quantization availability and checkpoint display mode; hub switching updates environment variables and refreshes model info; and all relevant changes persist to user config.

Usage

Use this component as the first element in the WebUI layout. It provides the model and adapter configuration that feeds into all downstream tabs (training, evaluation, inference, export). It is called by create_ui in the interface module.

Code Reference

Source Location

Signature

def create_top() -> dict[str, "Component"]: ...

Import

from llamafactory.webui.components.top import create_top

I/O Contract

Inputs

Name Type Required Description
(none) -- -- This function takes no parameters; it reads SUPPORTED_MODELS, METHODS, and TEMPLATES from constants

Outputs

Name Type Description
elem_dict dict[str, Component] Dictionary of named Gradio components: lang, model_name, model_path, hub_name, finetuning_type, checkpoint_path, quantization_bit, quantization_method, template, rope_scaling, booster

Usage Examples

# Adding the top panel to the main WebUI
from llamafactory.webui.components.top import create_top

engine.manager.add_elems("top", create_top())
lang = engine.manager.get_elem_by_id("top.lang")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment