mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-03 04:02:49 +08:00
parent
868444e124
commit
276def1897
@ -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