File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
src/compressed_tensors/quantization/lifecycle Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 31
31
from compressed_tensors .quantization .utils import is_kv_cache_quant_scheme
32
32
from compressed_tensors .utils import (
33
33
disable_hf_hook ,
34
- has_offloaded_params ,
34
+ get_execution_device ,
35
35
register_offload_parameter ,
36
36
)
37
37
from torch .nn import Module , Parameter
@@ -148,11 +148,8 @@ def _initialize_scale_zero_point(
148
148
if quantization_args .dynamic :
149
149
return
150
150
151
- # begin on the same device as other parameters or cpu if offloaded.
152
- # in the offloaded case, there's no point moving tensors to the execution device
153
- # if they're going to be immediately offloaded by `register_offload_parameter`
154
- params_device = next (module .parameters ()).device
155
- device = "cpu" if has_offloaded_params (module ) else params_device
151
+ # initialize on execution device to avoid performing quantized ops on cpu
152
+ device = get_execution_device (module )
156
153
157
154
# infer expected scale/zero point shape
158
155
if quantization_args .strategy == QuantizationStrategy .TOKEN :
You can’t perform that action at this time.
0 commit comments