Skip to content

Unsloth Studio GGUF export uses only GPU0 and ignores multiple GPUs during checkpoint loading #7053

Closed

Description

@majer2022

~/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/core/export/export.py

export.py
Problem:
Unsloth Studio GGUF export does not use multiple GPUs. The model is loaded only on GPU0, causing CUDA out of memory even when other GPUs have free VRAM.

Example:
GPU0: almost full (~23GB/24GB)
GPU1: 0GB
GPU2: 0GB

Temporary fix:

Edit file:

~/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/core/export/export.py

Find this part:

BEFORE:

model, tokenizer = FastLanguageModel.from_pretrained(
model_name = checkpoint_path,
max_seq_length = max_seq_length,
dtype = None,
load_in_4bit = load_in_4bit,
trust_remote_code = trust_remote_code,
token = token,
local_files_only = local_files_only,
)

Change to:

AFTER:

model, tokenizer = FastLanguageModel.from_pretrained(
model_name = checkpoint_path,
max_seq_length = max_seq_length,
dtype = None,
load_in_4bit = load_in_4bit,
trust_remote_code = trust_remote_code,
token = token,
local_files_only = local_files_only,
device_map = "auto",
)

Do the same for:

FastVisionModel.from_pretrained(

Add:

device_map = "auto",

after:

local_files_only = local_files_only,

After this change, export can distribute the model across multiple GPUs and avoids CUDA OOM on GPU0.

Suggested permanent fix:
Add device_map="auto" by default in the export pipeline or expose a multi-GPU export option in Unsloth Studio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions