You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to generate output with Gemma4 e2b on Windows, despite successful execution and training #13696
I am using machine translation from Japanese. #7055 #13388
I have confirmed that the execution and training issues for Gemma4 e2b have been fixed; however, generating output using GGUF or merged models results in the error shown below. The recommended solution is to set the offload option to "Auto," but while this setting exists in the Training tab, I cannot find it in the Output tab. Please fix this.
Environment
Where are you using Unsloth?
[ Here] Unsloth desktop application
Unsloth web UI (unsloth studio)
Unsloth CLI
Python package or notebook
Colab or Kaggle
Operating system and version:
I use Windows
GPU model(s) and accelerator backend:
RTX4060ti in NVIDIA CUDA
Versions:
v0.1.907-beta 2026.10.5
What happened?
Steps to reproduce:
1.Export the trained Gemma4 e2b in either merged or GGUF format on a Windows machine equipped with approximately 8 GB of VRAM. Expected behavior:
It is supposed to share VRAM and RAM for output.
Actual behavior:
The following error occurs, and it does not work. Model and operation involved:
Output the Gemma-4e2b model fine-tuned using Unsloth Desktop.
Diagnostics and logs
Desktop application
Text copied from the error pop-up
Failed to load checkpoint: Unsloth: unsloth/gemma-4-E2B-it-unsloth-bnb-4bit does not fit in GPU memory (cuda:0 has 6.84 GB free), so transformers placed part of it on the CPU, which bitsandbytes cannot quantize. Pass `offload_layers = "auto"` to from_pretrained to keep the decoder layers the GPU cannot hold in host RAM and stream them in during training (slower, and it needs that much free system RAM), load a smaller model, or free GPU memory held by other programs.
Additional context
I apologize for contacting you repeatedly, but I would like to request a correction.
I read your issue and listed some points to be checked before running the model
In your Windows system --> Go to Windows PowerShell ---> type nvidia-smi ---> see the actual VRAM left in your system
If the VRAM displays a good amount of space to run the Gemma-4e2b model, then check the connection, as you have not mentioned whether the GPU is integrated or using a GPU server
If all is checked successfully, then just run a small quantized model with the same dataset using QLoRA and keep the context length =512 instead, and for fewer steps, see if it is running and can be exported
If nothing works, try commenting -- will find the solution :)
I ran nvidia-smi.
The available memory is 1073 MiB / 8188 MiB.
Indeed, it would not be possible to fit everything into VRAM.
However, regarding the goal of exporting the model, I believe the intended behavior is to share the model between VRAM and RAM.
Okay, check available system RAM and whether another process is consuming most of your GPU memory.
If not solved, then close GPU-consuming applications, restart the studio, and try using a smaller model
Even I have investigated that automatic offloading during model loading is not the same as offloading during export.
Understood. The system is equipped with approximately 96 GB of RAM, with about 80 GB available for use.
When I invoked the Unsloth Python virtual environment and ran the export using Python code configured with offload_layers="auto", the export completed successfully. Therefore, wouldn't the issue be resolved by adding an option to select offload_layers to the UnslothDesktop export UI? I developed the specific code in consultation with Gemini. It is quite an unusual piece of code, as—in addition to applying offload_layers="auto"—it includes a fix for a bug where the system would incorrectly report insufficient space on the C drive even though the output destination was the G drive. I have attached it below. ```
Valid Studio/Desktop gap on low-VRAM export (here: Gemma-4 E2B on Windows ~8 GB, ~1 GB free in nvidia-smi).
The toast is literal:
Pass `offload_layers = "auto"` to from_pretrained to keep the decoder layers
the GPU cannot hold in host RAM …
Training already exposes Block Swap / offload_layers (including "auto"). Output / Export does not. Export’s load_checkpoint loads via FastLanguageModel / FastModel.from_pretrained with load_in_4bit and multi-GPU device_map, but never passes offload_layers. So when the checkpoint (or its base) does not fit for a 4-bit merge/GGUF load, bitsandbytes refuses the CPU spill and export dies — even though the same box has plenty of system RAM (reporter: ~80 GB free) and a manual Python load with offload_layers="auto" succeeds.
This is separate from earlier Gemma-4 train/run fixes (#7055, #13388) and from GGUF converter/mmproj issues. It’s specifically “export load cannot use the offload path Training already has.”
Narrow PR
Keep the base-model / full-finetune semantics unchanged; only plumb what Training already has into Export:
Accept offload_layers on the Export load/start API (default "auto" for the low-VRAM path, or mirror Training’s Auto control on the Output tab).
Pass it through ExportBackend.load_checkpoint → every from_pretrained call used for merge / GGUF.
Optional UI: the same Auto offload control Training shows, on Output, so users are not told to set something that isn’t there.
Reporter already proved the library path works with offload_layers="auto"; Studio just never offers it on export.
Fixed! The Output tab's export load never used the layer offloading Training already has, so on an 8 GB card the 4-bit Gemma 4 E2B load spilled to the CPU and bitsandbytes refused it. Export now retries that load automatically with the layers the GPU cannot hold kept in system RAM, so no new setting is needed. Fixed in #13720.
To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.
Activity
GANESHPARDESHI07 commentedon Oct 14, 2026
I read your issue and listed some points to be checked before running the model
If nothing works, try commenting -- will find the solution :)
sakana-max commentedon Oct 14, 2026
I ran
nvidia-smi.The available memory is 1073 MiB / 8188 MiB.
Indeed, it would not be possible to fit everything into VRAM.
However, regarding the goal of exporting the model, I believe the intended behavior is to share the model between VRAM and RAM.
GANESHPARDESHI07 commentedon Oct 14, 2026
Okay, check available system RAM and whether another process is consuming most of your GPU memory.
If not solved, then close GPU-consuming applications, restart the studio, and try using a smaller model
Even I have investigated that automatic offloading during model loading is not the same as offloading during export.
sakana-max commentedon Oct 14, 2026
Understood. The system is equipped with approximately 96 GB of RAM, with about 80 GB available for use.
When I invoked the Unsloth Python virtual environment and ran the export using Python code configured with
offload_layers="auto", the export completed successfully. Therefore, wouldn't the issue be resolved by adding an option to selectoffload_layersto the UnslothDesktop export UI? I developed the specific code in consultation with Gemini. It is quite an unusual piece of code, as—in addition to applyingoffload_layers="auto"—it includes a fix for a bug where the system would incorrectly report insufficient space on the C drive even though the output destination was the G drive. I have attached it below. ```indrajeetapache commentedon Oct 14, 2026
What’s going wrong
Valid Studio/Desktop gap on low-VRAM export (here: Gemma-4 E2B on Windows ~8 GB, ~1 GB free in
nvidia-smi).The toast is literal:
Training already exposes Block Swap /
offload_layers(including"auto"). Output / Export does not. Export’sload_checkpointloads viaFastLanguageModel/FastModel.from_pretrainedwithload_in_4bitand multi-GPUdevice_map, but never passesoffload_layers. So when the checkpoint (or its base) does not fit for a 4-bit merge/GGUF load, bitsandbytes refuses the CPU spill and export dies — even though the same box has plenty of system RAM (reporter: ~80 GB free) and a manual Python load withoffload_layers="auto"succeeds.This is separate from earlier Gemma-4 train/run fixes (#7055, #13388) and from GGUF converter/mmproj issues. It’s specifically “export load cannot use the offload path Training already has.”
Narrow PR
Keep the base-model / full-finetune semantics unchanged; only plumb what Training already has into Export:
offload_layerson the Export load/start API (default"auto"for the low-VRAM path, or mirror Training’s Auto control on the Output tab).ExportBackend.load_checkpoint→ everyfrom_pretrainedcall used for merge / GGUF.Reporter already proved the library path works with
offload_layers="auto"; Studio just never offers it on export.cc @danielhanchen
Studio: default export load to offload_layers=auto (#13720)
danielhanchen commentedon Oct 14, 2026
Fixed! The Output tab's export load never used the layer offloading Training already has, so on an 8 GB card the 4-bit Gemma 4 E2B load spilled to the CPU and bitsandbytes refused it. Export now retries that load automatically with the layers the GPU cannot hold kept in system RAM, so no new setting is needed. Fixed in #13720.
To update: Unsloth Desktop will have an update banner. For Studio, use
unsloth studio update. For Docker, usedocker exec <container> unsloth-studio-update. Reopen if it still happens.