Remove the check for meta device in _replace_with_low_bit_linear (#9984)

This commit is contained in:
Yuwen Hu 2024-01-24 18:15:39 +08:00 committed by GitHub
parent d4f65a6033
commit b27e5a27b9

View file

@ -203,7 +203,6 @@ def _replace_with_low_bit_linear(model, qtype, modules_to_not_convert=None,
if is_linear and name not in modules_to_not_convert: if is_linear and name not in modules_to_not_convert:
# Check if the current key is not in the `modules_to_not_convert` # Check if the current key is not in the `modules_to_not_convert`
if (not any(key in ".".join(current_key_name) for key in modules_to_not_convert) and if (not any(key in ".".join(current_key_name) for key in modules_to_not_convert) and
module.weight.data.device.type != 'meta' and
not isinstance(module, LowBitLinear)): not isinstance(module, LowBitLinear)):
in_features, out_features, mp_group = linear_args in_features, out_features, mp_group = linear_args
with init_empty_weights(): with init_empty_weights():