Fix global dequantize buffer dtype mismatch across mixed-precision loads (#4026)
Fix global dequantize buffer dtype mismatch when loading multiple 4-bit models with different dtypes in the same process. Adds dtype check alongside existing None check for WEIGHT_BUFFER in both CUDA/HIP and XPU paths.
This commit is contained in:
parent
721bf4852a
commit
afd5b687aa
1 changed files with 2 additions and 2 deletions
|
|
@ -398,7 +398,7 @@ if DEVICE_TYPE == "xpu" and HAS_XPU_STREAM:
|
|||
global ABSMAX_BUFFERS
|
||||
WEIGHT_BUFFER = WEIGHT_BUFFERS[device_index]
|
||||
ABSMAX_BUFFER = ABSMAX_BUFFERS[device_index]
|
||||
if WEIGHT_BUFFER is None:
|
||||
if WEIGHT_BUFFER is None or WEIGHT_BUFFER.dtype != dtype:
|
||||
WEIGHT_BUFFERS[device_index] = WEIGHT_BUFFER = torch_empty(
|
||||
size, dtype = dtype, device = device, requires_grad = False
|
||||
)
|
||||
|
|
@ -508,7 +508,7 @@ elif DEVICE_TYPE in ("cuda", "hip") and HAS_CUDA_STREAM:
|
|||
global ABSMAX_BUFFERS
|
||||
WEIGHT_BUFFER = WEIGHT_BUFFERS[device_index]
|
||||
ABSMAX_BUFFER = ABSMAX_BUFFERS[device_index]
|
||||
if WEIGHT_BUFFER is None:
|
||||
if WEIGHT_BUFFER is None or WEIGHT_BUFFER.dtype != dtype:
|
||||
WEIGHT_BUFFERS[device_index] = WEIGHT_BUFFER = torch_empty(
|
||||
size, dtype = dtype, device = device, requires_grad = False
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue