Skip to content

[Bug] Unsloth Studio UI: Dtype mismatch (float != c10::Half) during LoRA fine-tuning of gemma-4-E2B-it #4873

@hasso5703

Description

@hasso5703

Note: Please do not remove the questions. Answer beside them.

  1. Did you update? pip install --upgrade unsloth unsloth_zoo: Yes (Executed via the official Unsloth Studio Colab notebook).
  2. Colab or Kaggle or local / cloud: Colab
  3. Number GPUs used, use nvidia-smi: 1
  4. Which notebook? Please link!: Official Unsloth Studio Colab Notebook. https://colab.research.google.com/github/unslothai/unsloth/blob/main/studio/Unsloth_Studio_Colab.ipynb
  5. Which Unsloth version, TRL version, transformers version, PyTorch version?: Default versions from the official Unsloth Studio notebook (Logs indicate Transformers 5.x subprocess check).
  6. Which trainer? SFTTrainer, GRPOTrainer etc: Trainer used internally by Unsloth Studio UI for LoRA.
### Steps to reproduce error ###
1. Launch the official Unsloth Studio notebook on Google Colab.
2. Access the Fine-tuning Studio UI.
3. Upload a standard text-based dataset in ChatML format (is_image=False).
4. Select the model `unsloth/gemma-4-E2B-it`.
5. Start the LoRA fine-tuning process.
6. The UI crashes immediately at Step 0 / Epoch 0.00 with the error: 
   `expected mat1 and mat2 to have the same dtype, but got: float != c10::Half`

### Backend Logs ###
{"timestamp": "2026-04-06T11:20:49.408696Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/", "status_code": 200, "process_time_ms": 15.62}
{"timestamp": "2026-04-06T11:20:50.817547Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/health", "status_code": 200, "process_time_ms": 5.31}
{"timestamp": "2026-04-06T11:20:51.029838Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 16.87}
{"timestamp": "2026-04-06T11:20:51.241026Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 9.53}
{"timestamp": "2026-04-06T11:20:51.296631Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/", "status_code": 200, "process_time_ms": 6.67}
{"timestamp": "2026-04-06T11:20:52.120817Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 12.55}
{"timestamp": "2026-04-06T11:20:52.786249Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/health", "status_code": 200, "process_time_ms": 0.99}
{"timestamp": "2026-04-06T11:20:52.997869Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 12.11}
{"timestamp": "2026-04-06T11:20:53.199360Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 7.1}
{"timestamp": "2026-04-06T11:21:00.472590Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.91}
{"timestamp": "2026-04-06T11:21:02.192789Z", "level": "info", "event": "Helper GGUF cached: 1 file(s)"}
{"timestamp": "2026-04-06T11:21:06.313619Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/auth/login", "status_code": 200, "process_time_ms": 91.55}
{"timestamp": "2026-04-06T11:21:06.653009Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/auth/change-password", "status_code": 200, "process_time_ms": 149.91}
{"timestamp": "2026-04-06T11:21:06.833427Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.33}
{"timestamp": "2026-04-06T11:21:07.003991Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.29}
{"timestamp": "2026-04-06T11:21:07.175433Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.35}
{"timestamp": "2026-04-06T11:21:07.356139Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.29}
{"timestamp": "2026-04-06T11:21:12.881582Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/studio", "status_code": 200, "process_time_ms": 1.25}
{"timestamp": "2026-04-06T11:21:13.640077Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/health", "status_code": 200, "process_time_ms": 0.67}
{"timestamp": "2026-04-06T11:21:13.815168Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/auth/status", "status_code": 200, "process_time_ms": 1.27}
{"timestamp": "2026-04-06T11:21:14.827387Z", "level": "info", "event": "TrainingBackend initialized (subprocess mode)"}
{"timestamp": "2026-04-06T11:21:14.828985Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/local", "status_code": 200, "process_time_ms": 7.18}
{"timestamp": "2026-04-06T11:21:15.026121Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/local", "status_code": 200, "process_time_ms": 2.51}
{"timestamp": "2026-04-06T11:21:37.888180Z", "level": "info", "event": "Getting model config for: unsloth/gemma-4-E2B-it"}
{"timestamp": "2026-04-06T11:21:37.898783Z", "level": "info", "event": "Loaded model defaults from /content/unsloth/studio/backend/assets/configs/model_defaults/gemma/unsloth_gemma-4-E2B-it.yaml (via mapping)"}
{"timestamp": "2026-04-06T11:21:37.903249Z", "level": "info", "event": "Model 'unsloth/gemma-4-E2B-it' needs transformers 5.x — checking vision via subprocess"}
{"timestamp": "2026-04-06T11:21:56.609851Z", "level": "info", "event": "Vision check (subprocess, transformers 5.x) for 'unsloth/gemma-4-E2B-it': model_type=gemma4, architectures=['Gemma4ForConditionalGeneration'], is_vision=True"}
{"timestamp": "2026-04-06T11:21:57.185738Z", "level": "info", "event": "Model 'unsloth/gemma-4-E2B-it' needs transformers 5.x — checking vision via subprocess"}
{"timestamp": "2026-04-06T11:22:05.917374Z", "level": "info", "event": "Vision check (subprocess, transformers 5.x) for 'unsloth/gemma-4-E2B-it': model_type=gemma4, architectures=['Gemma4ForConditionalGeneration'], is_vision=True"}
{"timestamp": "2026-04-06T11:22:08.772679Z", "level": "info", "event": "Model config result for unsloth/gemma-4-E2B-it: is_vision=True, is_embedding=False, audio_type=None, is_lora=False, max_position_embeddings=None"}
{"timestamp": "2026-04-06T11:22:08.861976Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/models/config/unsloth/gemma-4-E2B-it", "status_code": 200, "process_time_ms": 30975.61}
{"timestamp": "2026-04-06T11:22:24.750861Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/datasets/upload", "status_code": 200, "process_time_ms": 10315.66}
{"timestamp": "2026-04-06T11:22:24.985488Z", "level": "info", "event": "Checking format for dataset: /root/.unsloth/studio/assets/datasets/uploads/74fdf7a8696840ef92ebf6eafb3546ac_dataset_ready.jsonl"}
{"timestamp": "2026-04-06T11:22:24.989702Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/datasets/local", "status_code": 200, "process_time_ms": 10.63}
Generating train split: 
 12755/0 [00:00<00:00, 36719.94 examples/s]
{"timestamp": "2026-04-06T11:22:25.781916Z", "level": "info", "event": "Format check result: requires_mapping=True, format=unknown, is_image=False"}
{"timestamp": "2026-04-06T11:22:25.786804Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/datasets/check-format", "status_code": 200, "process_time_ms": 812.53}
{"timestamp": "2026-04-06T11:23:08.124009Z", "level": "info", "event": "Checking format for dataset: /root/.unsloth/studio/assets/datasets/uploads/74fdf7a8696840ef92ebf6eafb3546ac_dataset_ready.jsonl"}
{"timestamp": "2026-04-06T11:23:08.348041Z", "level": "info", "event": "Format check result: requires_mapping=False, format=chatml, is_image=False"}
{"timestamp": "2026-04-06T11:23:08.352539Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/datasets/check-format", "status_code": 200, "process_time_ms": 231.54}
{"timestamp": "2026-04-06T11:23:08.622860Z", "level": "info", "event": "Starting training job with model: unsloth/gemma-4-E2B-it"}
{"timestamp": "2026-04-06T11:23:08.623720Z", "level": "info", "event": "Found local dataset file: /root/.unsloth/studio/assets/datasets/uploads/74fdf7a8696840ef92ebf6eafb3546ac_dataset_ready.jsonl"}
{"timestamp": "2026-04-06T11:23:08.632875Z", "level": "info", "event": "Loaded model defaults from /content/unsloth/studio/backend/assets/configs/model_defaults/gemma/unsloth_gemma-4-E2B-it.yaml (via mapping)"}
{"timestamp": "2026-04-06T11:23:08.635641Z", "level": "info", "event": "InferenceOrchestrator initialized (subprocess mode)"}
{"timestamp": "2026-04-06T11:23:08.637942Z", "level": "info", "event": "ExportOrchestrator initialized (subprocess mode)"}
{"timestamp": "2026-04-06T11:23:08.894402Z", "level": "info", "event": "Top GGUF models: ['unsloth/Qwen3.5-35B-A3B-GGUF', 'unsloth/Qwen3.5-9B-GGUF', 'unsloth/Qwen3.5-27B-GGUF', 'unsloth/gemma-4-26B-A4B-it-GGUF', 'unsloth/Qwen3.5-4B-GGUF', 'unsloth/gemma-4-31B-it-GGUF', 'unsloth/gemma-4-E4B-it-GGUF', 'unsloth/Qwen3.5-122B-A10B-GGUF', 'unsloth/Qwen3.5-0.8B-GGUF', 'unsloth/Qwen3.5-2B-GGUF', 'unsloth/Qwen3-Coder-Next-GGUF', 'unsloth/gpt-oss-20b-GGUF', 'unsloth/LTX-2.3-GGUF', 'unsloth/gemma-4-E2B-it-GGUF', 'unsloth/Nemotron-3-Nano-30B-A3B-GGUF', 'unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF', 'unsloth/GLM-4.7-Flash-GGUF', 'unsloth/gemma-3-27b-it-GGUF', 'unsloth/gpt-oss-120b-GGUF', 'unsloth/NVIDIA-Nemotron-3-Super-120B-A12B-GGUF', 'unsloth/gemma-3-12b-it-GGUF', 'unsloth/Qwen3-VL-4B-Instruct-GGUF', 'unsloth/Qwen-Image-Edit-2511-GGUF', 'unsloth/Qwen3.5-397B-A17B-GGUF', 'unsloth/DeepSeek-R1-Distill-Qwen-1.5B-GGUF', 'unsloth/Qwen2.5-VL-7B-Instruct-GGUF', 'unsloth/Llama-3.2-1B-Instruct-GGUF', 'unsloth/DeepSeek-R1-Distill-Qwen-14B-GGUF', 'unsloth/gemma-3-4b-it-GGUF', 'unsloth/gemma-3-270m-it-GGUF', 'unsloth/Qwen3-4B-Instruct-2507-GGUF', 'unsloth/Qwen3-VL-8B-Instruct-GGUF']"}
{"timestamp": "2026-04-06T11:23:08.895861Z", "level": "info", "event": "Top hub models: ['unsloth/mistral-7b-v0.3-bnb-4bit', 'unsloth/DeepSeek-OCR-2', 'unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit', 'unsloth/Llama-3.1-8B-Instruct', 'unsloth/GLM-4.7-Flash-FP8-Dynamic', 'unsloth/Qwen3-0.6B', 'unsloth/Meta-Llama-3.1-8B-Instruct', 'unsloth/Qwen3-0.6B-unsloth-bnb-4bit', 'unsloth/Qwen2.5-7B-Instruct-bnb-4bit', 'unsloth/Qwen3-4B-Instruct-2507-unsloth-bnb-4bit', 'unsloth/Qwen3.5-9B', 'unsloth/Qwen3-14B-unsloth-bnb-4bit', 'unsloth/Qwen3.5-4B', 'unsloth/Qwen2.5-7B', 'unsloth/gpt-oss-20b', 'unsloth/gpt-oss-20b-unsloth-bnb-4bit', 'unsloth/Qwen2.5-7B-Instruct', 'unsloth/GLM-4.7-Flash', 'unsloth/Llama-3.2-3B-Instruct', 'unsloth/Llama-3.2-1B-Instruct', 'unsloth/Qwen2.5-3B-Instruct-unsloth-bnb-4bit', 'unsloth/Qwen3.5-2B', 'unsloth/Qwen3-1.7B-unsloth-bnb-4bit', 'unsloth/gpt-oss-120b-BF16', 'unsloth/Qwen3-8B-unsloth-bnb-4bit', 'unsloth/Qwen2-7B', 'unsloth/gpt-oss-20b-BF16', 'unsloth/Qwen3.5-0.8B', 'unsloth/Llama-3.2-1B-Instruct-unsloth-bnb-4bit', 'unsloth/Llama-3.2-3B-Instruct-unsloth-bnb-4bit', 'unsloth/Qwen2.5-7B-Instruct-unsloth-bnb-4bit', 'unsloth/Mistral-Small-3.2-24B-Instruct-2506-bnb-4bit', 'unsloth/Qwen2.5-0.5B-unsloth-bnb-4bit', 'unsloth/Llama-3.2-1B', 'unsloth/Qwen3-4B-bnb-4bit', 'unsloth/Qwen3-VL-4B-Instruct', 'unsloth/llama-3-8b-bnb-4bit', 'unsloth/Qwen3-1.7B', 'unsloth/Qwen3-4B', 'unsloth/Qwen3-4B-unsloth-bnb-4bit']"}
{"timestamp": "2026-04-06T11:23:09.084698Z", "level": "info", "event": "Model 'unsloth/gemma-4-E2B-it' needs transformers 5.x — checking vision via subprocess"}
{"timestamp": "2026-04-06T11:23:17.096925Z", "level": "info", "event": "Vision check (subprocess, transformers 5.x) for 'unsloth/gemma-4-E2B-it': model_type=gemma4, architectures=['Gemma4ForConditionalGeneration'], is_vision=True"}
{"timestamp": "2026-04-06T11:23:17.657197Z", "level": "info", "event": "Model 'unsloth/gemma-4-E2B-it' needs transformers 5.x — checking vision via subprocess"}
{"timestamp": "2026-04-06T11:23:26.531200Z", "level": "info", "event": "Vision check (subprocess, transformers 5.x) for 'unsloth/gemma-4-E2B-it': model_type=gemma4, architectures=['Gemma4ForConditionalGeneration'], is_vision=True"}
{"timestamp": "2026-04-06T11:23:26.761886Z", "level": "warning", "event": "Could not load config for 'unsloth/gemma-4-E2B-it': The checkpoint you are trying to load has model type `gemma4` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.\n\nYou can update Transformers with the command `pip install --upgrade transformers`. If this does not work, and the checkpoint is very new, then there may not be a release version that supports this model yet. In this case, you can get the most up-to-date code by installing Transformers from source with the command `pip install git+https://github.com/huggingface/transformers.git`"}
{"timestamp": "2026-04-06T11:23:26.815725Z", "level": "info", "event": "Training subprocess started (pid=4604)"}
{"timestamp": "2026-04-06T11:23:26.834966Z", "level": "info", "event": "request_completed", "method": "POST", "path": "/api/train/start", "status_code": 200, "process_time_ms": 18216.02}
{"timestamp": "2026-04-06T11:23:28.274804Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/train/progress", "status_code": 200, "process_time_ms": 5.81}
=={"timestamp": "2026-04-06T11:33:42.234434Z", "level": "error", "event": "Training error: expected mat1 and mat2 to have the same dtype, but got: float != c10::Half"}
Image

-> https://colab.research.google.com/gist/hasso5703/5c6e08a9a142a80dd0d62ac67200f55f/unsloth_studio_colab.ipynb

same thing with qwen3.5-2B :

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions