-
Notifications
You must be signed in to change notification settings - Fork 2
Issue 23 - Multi-GPU device_map fix for GraniteSwitch #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ItzikVa
wants to merge
4
commits into
main
Choose a base branch
from
issue-23
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fff3b85
Make HF model buffers non-persistent to fix multi-GPU device_map error
ItzikVa 3816d41
Move non-persistent buffers to input device in forward pass
ItzikVa 10c6ec1
Add _keys_to_ignore_on_load_unexpected for old checkpoint buffers
ItzikVa 0596329
Rebuild non-persistent buffers from config on first forward
ItzikVa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # vLLM Quantization — Status Summary | ||
|
|
||
| **Date**: 2026-05-13 | ||
| **Branch**: `feature/quantized-inference-testing` | ||
| **Status**: Partially fixed, needs GPU validation | ||
|
|
||
| --- | ||
|
|
||
| ## Issues Found and Fixed | ||
|
|
||
| ### 1. BnB dtype error in `SwitchedLoRALinear` (commit `93db1b0`) | ||
|
|
||
| **Problem**: When BitsAndBytes quantizes base layers, the weight dtype becomes `uint8`. | ||
| `SwitchedLoRALinear.__init__` used `base_layer.weight.dtype` to allocate LoRA params, | ||
| causing them to be `uint8` instead of float — breaking LoRA computation. | ||
|
|
||
| **Fix** (`src/granite_switch/vllm/core/lora.py:107-110`): | ||
| ```python | ||
| if not dtype.is_floating_point: | ||
| dtype = torch.bfloat16 | ||
| ``` | ||
|
|
||
| ### 2. OOM on A100 80GB with BnB loading (commit `3a91e71`) | ||
|
|
||
| **Problem**: BnB holds full-precision weights during quantization pass. Default | ||
| `gpu_memory_utilization=0.8` caused OOM. | ||
|
|
||
| **Fix**: Lowered to `0.5` in the diagnostic script. | ||
|
|
||
| ### 3. xdist group marker (added `7a2b02b`, reverted `9cd26f6`) | ||
|
|
||
| Attempted to group quantization tests for xdist but reverted — not the right approach. | ||
|
|
||
| --- | ||
|
|
||
| ## What Exists | ||
|
|
||
| | File | Purpose | Status | | ||
| |------|---------|--------| | ||
| | `quantization/test_quantized_inference.py` | Standalone vLLM BnB diagnostic script | Ready to run on GPU, no pytest | | ||
| | `quantization/quantization_testing.ipynb` | Exploration notebook (FP8/GPTQ/AWQ via API server) | Unused, no outputs | | ||
| | `tests/hf/test_quantization.py` | Formal HF backend pytest (BnB NF4/FP4, Quanto INT4/FP8) | Passing | | ||
|
|
||
| --- | ||
|
|
||
| ## What's Missing | ||
|
|
||
| 1. **No pytest coverage for vLLM + BnB** — only the standalone diagnostic script exists | ||
| 2. **No GPU validation yet** — the dtype fix (`93db1b0`) hasn't been confirmed on a real GPU | ||
| with the full vLLM loading path | ||
| 3. **FP8/GPTQ/AWQ on vLLM** — the notebook was designed for this but never executed | ||
|
|
||
| --- | ||
|
|
||
| ## Key Parameters for vLLM BnB Loading | ||
|
|
||
| ```python | ||
| from vllm import LLM | ||
|
|
||
| llm = LLM( | ||
| model="ibm-granite/granite-switch-4.1-3b-preview", | ||
| quantization="bitsandbytes", | ||
| load_format="bitsandbytes", | ||
| gpu_memory_utilization=0.5, # Lower than default — BnB needs headroom | ||
| enforce_eager=True, # CUDA graphs don't work with BnB | ||
| ) | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Next Steps (when resuming) | ||
|
|
||
| 1. Run `quantization/test_quantized_inference.py` on a GPU pod to confirm BnB fix works end-to-end | ||
| 2. If it passes, convert into a proper pytest test in `tests/vllm/test_quantization.py` | ||
| 3. Investigate FP8/GPTQ support via vLLM (different from BnB path) | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file