mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-02 19:52:50 +08:00
parent
868444e124
commit
276def1897
@ -109,7 +109,10 @@ def load_model(
|
||||
|
||||
if not is_trainable:
|
||||
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()
|
||||
else:
|
||||
model.train()
|
||||
|
Loading…
x
Reference in New Issue
Block a user