Skip to content

DeepSeek V4.1: GPTQModel.load(placement=Placement.budget(...)) raises ValueError: dtype is not a valid dtype: torch.int8 #6541

Done

Description

@Qubitium

Summary

On main (c649fcb), loading a DeepSeek V4.1 Flash checkpoint with a byte budget fails before any weights are placed:

from gptqmodel import GPTQModel
from gptqmodel.weight_loader import Placement
GPTQModel.load(v41_dir, placement=Placement.budget({"cuda:0": "40GiB"}))   # or {"cpu": "..."}
gptqmodel/models/ports/deepseek_v41_flash/checkpoint.py:143: in _infer_placements
    sizes = compute_module_sizes(model)
gptqmodel/utils/vram.py:157: in compute_module_sizes
gptqmodel/utils/vram.py:66: ValueError: `dtype` is not a valid dtype: torch.int8.

tests/module_tree/test_deepseek_v41_flash.py::test_v41_cuda_load_runs_packed_projections[128] fails with the same error on CUDA.

Root cause

#6473 replaced Accelerate's infer_auto_device_map in the V4.1 budget path with gptqmodel.utils.vram.compute_module_sizes. Its dtype_byte_size only knows bool/fp8-family/fp16/bf16/fp32/int32 and raises for every other torch dtype. V4.1 stores packed FP4/FP8 payloads and scales as int8/uint8, so every budget placement fails. gptqmodel.utils.get_vram hits the same error for any model with int8/uint8/int64/float64 tensors.

Expected

Every torch dtype counts its element size (torch.empty((), dtype=d).element_size()); the budget packs and loads, and a budget too small for a unit raises the documented "does not fit" error.

Fix PR to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions