[Studio] Show non exported models in chat UI#4892
[Studio] Show non exported models in chat UI#4892Datta0 wants to merge 3 commits intounslothai:mainfrom
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Code Review
This pull request expands the Studio Chat's model discovery to include full finetune outputs in addition to LoRA adapters. It introduces a more robust base model detection mechanism via get_base_model_from_checkpoint and updates the backend scanning logic and frontend UI to support and label these "Full" finetune models. A potential issue was identified in the directory-name-based base model detection where an unexpected naming pattern could result in an invalid model string.
| model_parts = parts[1:-1] | ||
| base_model = "unsloth/" + "_".join(model_parts) | ||
| logger.info("Detected base model from directory name: %s", base_model) | ||
| return base_model |
There was a problem hiding this comment.
If the directory name doesn't follow the expected unsloth_{model}_{timestamp} pattern (e.g., just unsloth_12345), model_parts will be empty, resulting in an invalid base_model string like unsloth/. Adding a check to ensure model_parts is not empty before returning would be safer.
| model_parts = parts[1:-1] | |
| base_model = "unsloth/" + "_".join(model_parts) | |
| logger.info("Detected base model from directory name: %s", base_model) | |
| return base_model | |
| model_parts = parts[1:-1] | |
| if model_parts: | |
| base_model = "unsloth/" + "_".join(model_parts) | |
| logger.info("Detected base model from directory name: %s", base_model) | |
| return base_model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be146de451
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| trained_models = scan_trained_models(outputs_dir = resolved_outputs_dir) | ||
| for display_name, model_path, model_type in trained_models: |
There was a problem hiding this comment.
Filter non-LoRA training outputs from LoRA scan response
This loop now appends every scan_trained_models entry (including model_type == "merged") into /api/models/loras. The chat UI determines LoRA compare mode by checking whether the active checkpoint exists in state.loras (useIsLoraCompare in chat-page.tsx), so full-finetune checkpoints from training are now misclassified as LoRAs and routed through adapter-toggle compare logic. In that scenario users get an incorrect base-vs-finetuned flow on non-PEFT models; only true adapter outputs should be returned in the LoRA list (or merged checkpoints should be surfaced via a separate list/flag consumed by compare-mode selection).
Useful? React with 👍 / 👎.
Fixes #4888
We now fetch LoRAs and trained models (for full finetune) to be shown without one needing to explicitly "export". The models are already on disk so we just show them
Note: We do not yet show intermediate checkpoints from the training run. Only the final stored file.