Repository navigation
fix(vram): size every torch dtype so DeepSeek V4.1 budget placement loads - #6543
Merged
Merged
Conversation
…oads (#6541) #6473 moved the V4.1 Placement.budget path from Accelerate's infer_auto_device_map to utils.vram.compute_module_sizes, whose dtype_byte_size raised for int8/uint8 (and int64/float64). V4.1 keeps its packed payloads and scales in those dtypes, so every budget load raised ValueError before placement. Fall back to the dtype's element size for any other torch dtype. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6541
Root cause
#6473 replaced Accelerate's
infer_auto_device_mapin the DeepSeek V4.1Placement.budgetpath withgptqmodel.utils.vram.compute_module_sizes. Itsdtype_byte_sizeonly handled bool / one-byte floats / fp16 / bf16 / fp32 / int32 and raisedValueError: dtype is not a valid dtypefor any other torch dtype. V4.1 stores its packed FP4/FP8 payloads and scales as int8/uint8, soGPTQModel.load(v41, placement=Placement.budget({...}))always failed before placement.gptqmodel.utils.get_vramfailed the same way on int8/uint8/int64/float64 tensors.Fix
dtype_byte_sizefalls back totorch.empty((), dtype=dtype).element_size()for any othertorch.dtype. The existing explicit branches (including sub-byte string formats) and theValueErrorfor non-dtypes are unchanged. No control-flow change outside this function, so no diagram.Tests
tests/module_tree/test_deepseek_v41_flash.py::test_v41_cpu_budget_placement_loads_packed_checkpoint[128](new; CPU budget load is byte-identical todevice="cpu"load)dtype is not a valid dtype: torch.int8...::test_v41_budget_that_cannot_hold_a_unit_raises_the_fit_error[128](new; 1 KiB budget gives the documented "does not fit" error)...::test_v41_cuda_load_runs_packed_projections[128](existing, RTX 4090 sm_89, Marlin path, budget{"cuda:0": "1GiB"})dtype is not a valid dtype: torch.int8tests/test_vram_non_persistent_buffers.py::test_compute_module_sizes_counts_every_torch_dtype(new; hand-computed byte counts for int8/uint8/int64/float64/bf16 plusget_vram)pytest tests/module_tree/test_deepseek_v41_flash.py tests/test_vram_non_persistent_buffers.pyuvx [email protected] check gptqmodel ... tests setup.pyNot verified: multi-GPU budget packing (single GPU assigned), native-MX path on sm_100+ (Blackwell not exercised).
🤖 Generated with Claude Code