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
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]c27a5beed839
diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.pyindex 3b10ec26fb4..a93a6c917fc 100644--- a/unsloth/import_fixes.py+++ b/unsloth/import_fixes.py@@ -22,14 +22,22 @@ import loggingimport textwrap# We cannot do from unsloth_zoo.log import logger since FBGEMM might cause seg faults.-UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") in ("1", "True", "true",)+UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") in (+ "1",+ "True",+ "true",+)logger = logging.getLogger(__name__)if UNSLOTH_ENABLE_LOGGING:- logging.basicConfig(level = logging.INFO, format = '[%(name)s|%(levelname)s]%(message)s')+ logging.basicConfig(+ level = logging.INFO, format = "[%(name)s|%(levelname)s]%(message)s"+ )logger.setLevel(logging.INFO)else:- logging.basicConfig(level = logging.WARNING, format = '[%(name)s|%(levelname)s]%(message)s')- logger.setLevel(logging.WARNING)+ logging.basicConfig(+ level = logging.WARNING, format = "[%(name)s|%(levelname)s]%(message)s"+ )+ logger.setLevel(logging.WARNING)def Version(version):@@ -118,7 +126,9 @@ def fix_xformers_performance_issue():if Version(xformers_version) < Version("0.0.29"):xformers_location = importlib.util.find_spec("xformers").originif xformers_location is None:- xformers_location = importlib.util.find_spec("xformers").submodule_search_locations[0]+ xformers_location = importlib.util.find_spec(+ "xformers"+ ).submodule_search_locations[0]else:xformers_location = os.path.split(xformers_location)[0]cutlass = Path(xformers_location) / "ops" / "fmha" / "cutlass.py"@@ -150,7 +160,9 @@ def fix_vllm_aimv2_issue():if Version(vllm_version) < Version("0.10.1"):vllm_version = importlib.util.find_spec("vllm").originif vllm_version is None:- vllm_version = importlib.util.find_spec("vllm").submodule_search_locations[0]+ vllm_version = importlib.util.find_spec("vllm").submodule_search_locations[+ 0+ ]else:vllm_version = os.path.split(vllm_version)[0]ovis_config = Path(vllm_version) / "transformers_utils" / "configs" / "ovis.py"@@ -440,7 +452,9 @@ def fix_executorch():returnexecutorch_location = importlib.util.find_spec("executorch").originif executorch_location is None:- executorch_location = importlib.util.find_spec("executorch").submodule_search_locations[0]+ executorch_location = importlib.util.find_spec(+ "executorch"+ ).submodule_search_locations[0]else:executorch_location = os.path.split(executorch_location)[0]executorch = Path(executorch_location) / "examples" / "models" / "__init__.py"@@ -448,7 +462,7 @@ def fix_executorch():returntry:- what = r'''+ what = r"""import sysimport typesimport re@@ -483,9 +497,9 @@ def fix_executorch():sys.modules["torchtune"] = torchtunesys.modules["torchtune.models"] = modelssys.modules["torchtune.models.convert_weights"] = convert_weights- '''+ """what = textwrap.dedent(what)-+with open(executorch, "r+", encoding = "utf-8") as f:text = f.read()bad = "from enum import Enum\n"@@ -494,8 +508,6 @@ def fix_executorch():f.seek(0)f.write(text)f.truncate()- logger.info(- "Unsloth: Patching Executorch to fix get_mapped_key"- )+ logger.info("Unsloth: Patching Executorch to fix get_mapped_key")except Exception as e:logger.info(f"Unsloth: Failed Executorch with error = {str(e)}")diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex 3fd180bb272..31316e45b7a 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -741,7 +741,7 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):"generation_kwargs": {},"bf16": False,"fp16": False,- "report_to" : "none",+ "report_to": "none","include_tokens_per_second": False,"include_num_input_tokens_seen": False,"auto_find_batch_size": False, # Auto /2 batch size - too many people complained so removing