Enable XPU for blockwise quantization and FSDP tests#1921
Enable XPU for blockwise quantization and FSDP tests#1921jiqing-feng wants to merge 7 commits intobitsandbytes-foundation:mainfrom
Conversation
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
|
Hi @jiqing-feng, Using Otherwise, looks good! |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
Hi @matthewdouglas . I have added backwards compatibility for torch versions without torch.accelerator by falling back to torch.cuda/torch.xpu checks and device setup, while keeping the torch.accelerator path for newer versions. |
|
The failed tests seems like an env issue. Is this because the change of |
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
|
@jiqing-feng I think we just need to skip that test on Windows. Otherwise to have a chance at working we'd probably need to switch |
|
Hi @matthewdouglas . I have skipped fsdp on Windows for all devices, please check it. Thanks! |
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Summary
Replace CUDA-only guards with device-agnostic
torch.acceleratorAPIs so that XPU (and other accelerators) can run the blockwise quantization and FSDP state_dict tests.Changes
tests/test_functional.py
test_dynamic_blockwise_quantizationparameter matrix (nested, non-256 blocksizes, fp16/bf16) instead of skipping them as "non-CUDA".tests/test_linear4bit.py
torch.cuda.is_available()and NCCL-specific skip guards ontest_fsdp_state_dict_save_4bitwith a singletorch.accelerator.is_available()check.tests/fsdp_state_dict_save.py
torch.accelerator.current_accelerator()and map it to the correct distributed backend (CUDA → nccl, XPU → xccl).torch.cuda.set_device()withtorch.accelerator.set_device_index()and use the detected device type formodel.to().Hi @matthewdouglas . Would you please review this PR? Thanks!