This commit is contained in:
hiyouga 2024-03-24 00:34:54 +08:00
parent a1c8c98c5f
commit 7afbc85dae
1 changed files with 3 additions and 0 deletions

View File

@ -110,6 +110,9 @@ def load_model(
if not is_trainable:
model.requires_grad_(False)
model.eval()
for param in model.parameters():
if param.device.type == "cuda":
param.data = param.data.to(model_args.compute_dtype)
else:
model.train()