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 Eval Component

From Leeroopedia


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

Overview

Gradio evaluation and prediction tab component that provides the UI for configuring and launching model evaluation or prediction tasks.

Description

The eval.py module defines create_eval_tab, which builds the complete evaluation tab layout with Gradio components. It includes dataset directory and selection inputs with an integrated preview box, configuration sliders for cutoff length, max samples, batch size, and a predict checkbox. Generation parameters (max_new_tokens, top_p, temperature) and an output directory textbox are provided for controlling evaluation behavior. The tab includes command preview, start, and stop buttons wired to the engine runner's preview_eval, run_eval, and set_abort methods respectively, plus a progress monitor triggered by a hidden resume checkbox.

Usage

Use this component when assembling the main WebUI to provide evaluation and prediction capabilities. It is instantiated within create_ui in the interface module as the "Evaluate & Predict" tab.

Code Reference

Source Location

Signature

def create_eval_tab(engine: "Engine") -> dict[str, "Component"]: ...

Import

from llamafactory.webui.components.eval import create_eval_tab

I/O Contract

Inputs

Name Type Required Description
engine Engine Yes The WebUI engine instance providing access to Manager and Runner

Outputs

Name Type Description
elem_dict dict[str, Component] Dictionary of all named Gradio components: dataset_dir, dataset, data_preview_btn, preview_count, page_index, prev_btn, next_btn, close_btn, preview_samples, cutoff_len, max_samples, batch_size, predict, max_new_tokens, top_p, temperature, output_dir, cmd_preview_btn, start_btn, stop_btn, resume_btn, progress_bar, output_box

Usage Examples

# Assembling the eval tab within the main UI
from llamafactory.webui.components.eval import create_eval_tab

with gr.Tab("Evaluate & Predict"):
    engine.manager.add_elems("eval", create_eval_tab(engine))

Related Pages

Page Connections

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