Skip to content

fix: show pre-loaded model status in Gradio UI when initialized via CLI arguments - #5

Open
dailingx wants to merge 1 commit into
XiaomiMiMo:mainfrom
dailingx:dev
Open

fix: show pre-loaded model status in Gradio UI when initialized via CLI arguments#5
dailingx wants to merge 1 commit into
XiaomiMiMo:mainfrom
dailingx:dev

Conversation

@dailingx

Copy link
Copy Markdown

Description:

Problem

When the model is loaded at startup via --model-path and --tokenizer-path CLI arguments,
the "Initialization status" textbox in the Gradio UI still shows the placeholder text
"Click the initialize model button to start...", giving the false impression that the model
has not been initialized yet.

Solution

Pass the initialization result message from initialize_model() into create_interface() as
init_status_msg, and use it as the initial value of the status textbox. When the model is
pre-loaded via CLI, the UI immediately reflects the actual state ("Model loaded successfully!")
on page load.

Changes

  • create_interface() now accepts an optional init_status_msg parameter (defaults to "")
  • The "Initialization status" textbox is pre-populated with this value at render time
  • main() captures the return value of initialize_model() and forwards it to create_interface()

Behavior After Fix

Scenario Before After
Model loaded via CLI args Shows placeholder text Shows "Model loaded successfully!"
No CLI args (manual init) Shows placeholder text Shows placeholder text (unchanged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant