mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
parent
4881f4e631
commit
c635bbe465
@ -109,7 +109,10 @@ def load_model(
|
|||||||
|
|
||||||
if not is_trainable:
|
if not is_trainable:
|
||||||
model.requires_grad_(False)
|
model.requires_grad_(False)
|
||||||
model = model.to(model_args.compute_dtype) if not getattr(model, "quantization_method", None) else model
|
if not getattr(model, "quantization_method", None):
|
||||||
|
for param in filter(lambda p: p.device.type == "cuda", model.parameters()):
|
||||||
|
param.data = param.data.to(model_args.compute_dtype)
|
||||||
|
|
||||||
model.eval()
|
model.eval()
|
||||||
else:
|
else:
|
||||||
model.train()
|
model.train()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user