Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
fixes / cleanup
Dan Saunders7828f77175f6
diff --git a/cli.py b/cli.pyindex c820a8d73b3..f960eee95ff 100644--- a/cli.py+++ b/cli.py@@ -1,4 +1,3 @@-import loggingimport sysimport timefrom pathlib import Path@@ -15,15 +14,6 @@ app = typer.Typer()-def configure_logging(verbose: bool):- level = logging.DEBUG if verbose else logging.INFO- logging.basicConfig(- level=level,- format="%(asctime)s [%(levelname)s] %(name)s - %(message)s",- datefmt="%H:%M:%S",- )--@app.command()@add_options_from_config(Config)def train(@@ -41,12 +31,9 @@ def train("--dry-run",help="Show resolved config and exit without training.",),- verbose: bool = typer.Option(False, "--verbose/--quiet"),- config_overrides: dict = None, # Injected by decorator+ config_overrides: dict = None, # Injected by add_options_from_config decorator):- """- Launch training using the existing Unsloth training backend.- """+ """Launch training using the existing Unsloth training backend."""try:cfg = load_config(config)except FileNotFoundError as e:@@ -79,7 +66,6 @@ def train(from backend.trainer import UnslothTrainerfrom backend.model_config import ModelConfig- configure_logging(verbose)trainer = UnslothTrainer()model_config = ModelConfig.from_ui_selection(@@ -155,16 +141,12 @@ def inference(),max_seq_length: int = typer.Option(2048, "--max-seq-length"),load_in_4bit: bool = typer.Option(True, "--load-in-4bit/--no-load-in-4bit"),- verbose: bool = typer.Option(False, "--verbose/--quiet"),):- """- Run a single inference using the specified model.- """+ """Run a single inference using the specified model."""# Lazy imports to avoid triggering Unsloth patches on --helpfrom backend.model_config import ModelConfigfrom backend.inference import get_inference_backend- configure_logging(verbose)inference_backend = get_inference_backend()model_config = ModelConfig.from_ui_selection(dropdown_value=model, search_value=None, hf_token=hf_token, is_lora=Falsediff --git a/cli/config.py b/cli/config.pyindex bcfa02153bc..d80f3a2f635 100644--- a/cli/config.py+++ b/cli/config.py@@ -80,7 +80,7 @@ class Config(BaseModel):"""Return kwargs for trainer.prepare_model_for_training()."""# Determine target modules based on model typeif use_lora and is_vision:- target_modules = ["all-linear"] if self.lora.vision_all_linear else []+ target_modules = "all-linear" if self.lora.vision_all_linear else []else:target_modules = [m.strip() for m in self.lora.target_modules.split(",") if m.strip()]diff --git a/cli/options.py b/cli/options.pyindex 18336efca75..e9269a6cd13 100644--- a/cli/options.py+++ b/cli/options.py@@ -46,9 +46,8 @@ def _get_python_type(annotation: Any) -> type:def _collect_config_fields(config_class: type[BaseModel]) -> list[tuple[str, Any]]:"""- Collect all fields from a config class, flattening nested models.- Returns list of (name, field_info) tuples.- Raises ValueError on duplicate field names.+ Collect all fields from a config class, flattening nested models. Returns list of+ (name, field_info) tuples. Raises ValueError on duplicate field names."""fields = []seen_names: set[str] = set()