UnslothGKDTrainer SyntaxError with Gemma 3: Missing unsloth_zoo Directory I'm trying to fine tune Gemma 3 models (egodfred/gemma-3-finetune-text_to_sql, nadmozg/gemma-3-12b-it-sql-finetuned, google/gemma-3-4b-it) for SQL generation using Unsloth in a Conda environment, but I keep encountering a SyntaxError related to UnslothGKDTrainer.py. The file and its parent directory unsloth_zoo are missing, preventing me from importing unsloth.FastLanguageModel. I've tried multiple solutions, but none have resolved the issue. Any help or insights would be greatly appreciated! Environment OS: Ubuntu 22.04 Python: 3.10 PyTorch: 2.5.1+cu121 Transformers: 4.51.3 Unsloth: 2025.5.4 (commit 17c976c) Other Dependencies: bitsandbytes==0.45.5, peft==0.13.0, accelerate==1.0.1, trl==0.11.4, pandas, tqdm, python-dotenv, openai Hardware: NVIDIA RTX 4090 (24GB VRAM) NVIDIA Driver: 566.24, CUDA 12.7 Error Messages When running: from unsloth import FastLanguageModel print('Unsloth imported successfully') I get: Unsloth: Will patch your computer to enable 2x faster free finetuning. Unsloth Zoo will now patch everything to make training faster! Standard import failed for UnslothGKDTrainer: non-default argument follows default argument (UnslothGKDTrainer.py, line 621). Using tempfile instead! Standard import failed for UnslothGKDTrainer: non-default argument follows default argument (UnslothGKDTrainer.py, line 621). Using spec.loader.exec_module instead! Traceback (most recent call last): File "/home/ubuntu2022/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth_zoo/compiler.py", line 391, in create_new_function new_module, old_path = import_module(compile_folder, name) File "/home/ubuntu2022/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth_zoo/compiler.py", line 386, in import_module new_module = importlib.import_module(name) ... File "/home/ubuntu2022/unsloth_compiled_cache/UnslothGKDTrainer.py", line 621 sft_args, ^^^^^^^^ SyntaxError: non-default argument follows default argument During handling of the above exception, another exception occurred: ... Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/ubuntu2022/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth/__init__.py", line 247, in <module> from .models import * ... File "/home/ubuntu2022/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth_zoo/compiler.py", line 418, in create_new_function raise RuntimeError(f"Direct module loading failed for {name}: {e}") RuntimeError: Direct module loading failed for UnslothGKDTrainer: non-default argument follows default argument (UnslothGKDTrainer.py, line 621) Problem Details The error suggests a syntax issue in UnslothGKDTrainer.py (line 621), likely a function (e.g., __init__) with a non-default argument (sft_args) following a default argument (model=None). The file UnslothGKDTrainer.py is missing from ~/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth_zoo/. The entire unsloth_zoo directory is missing in both the installed package and the cloned repository (~/unsloth_repo/unsloth). The error references cached files (/home/ubuntu2022/unsloth_compiled_cache/UnslothGKDTrainer.py), but these are inaccessible or dynamically generated. Solutions Tried Reinstalled Unsloth Multiple Times: Command: pip install --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" Result: Always resolves to commit 17c976c (~March 2025), installs unsloth-2025.5.4 and unsloth_zoo-2025.5.6, but unsloth_zoo directory is missing. Cleared Caches and Package Files: Commands: rm -rf ~/unsloth_compiled_cache rm -rf /tmp/unsloth_compiled_cache rm -rf ~/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth* rm -rf ~/miniconda/envs/cu121torch251/lib/python3.10/site-packages/unsloth_zoo* Result: Removed cached files, but reinstalling Unsloth still lacks unsloth_zoo. Recreated Conda Environment: Removed cu127torch251 and created cu121torch251: conda env remove -n cu127torch251 conda create -n cu121torch251 python=3.10 -y pip install torch==2.5.1+cu121 torchvision==0.20.1+cu121 torchaudio==2.5.1+cu121 --index-url https://download.pytorch.org/whl/cu121 pip install --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" transformers==4.51.3 bitsandbytes==0.45.5 peft==0.13.0 accelerate==1.0.1 trl==0.11.4 pandas tqdm python-dotenv openai Result: Fresh environment, but unsloth_zoo still missing. Cloned Unsloth Repository: Command: git clone https://github.com/unslothai/unsloth.git ~/unsloth_repo/unsloth cd ~/unsloth_repo/unsloth ls unsloth_zoo/ Result: No such file or directory. Top-level structure: CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md images/ pyproject.toml tests/ unsloth/ unsloth-cli.py No unsloth_zoo or UnslothGKDTrainer.py. Checked for Alternative Files: Command: find . -name "UnslothGKDTrainer.py" -o -name "*GKDTrainer.py" -o -name "*Trainer.py" Result: No matching files in the repository. Tried Patching (Not Possible): Planned to patch UnslothGKDTrainer.py to reorder arguments, but the file is missing. Questions Has unsloth_zoo been removed or relocated in Unsloth (v2025.5.4 or main branch)? If so, how can I resolve the SyntaxError? Are there specific commits post-March 2025 (post-17c976c) that restore unsloth_zoo or fix the SyntaxError? I’ve checked Unsloth issues on GitHub, but no recent reports match this exact problem. Any suggestions, fixes, or pointers to relevant commits would be greatly appreciated! I can share more details (e.g., script snippets) if needed. Continue reading...