set new linear status (#9639)

This commit is contained in:
Xin Qiu 2023-12-08 11:02:49 +08:00 committed by GitHub
parent 499100daf1
commit 5636b0ba80

View file

@ -258,6 +258,8 @@ def _replace_with_low_bit_linear(model, qtype, modules_to_not_convert=None,
# fp16 may generalize to other sizes later
if new_linear is not None:
if not module.training:
new_linear.eval()
model._modules[name] = new_linear
has_been_replaced = True
# Force requires grad to False to avoid unexpected errors