Skip to content

Commit

Permalink
Merge pull request OpenBMB#153 from whn09/main
Browse files Browse the repository at this point in the history
combine dtype and device to save CPU memory
  • Loading branch information
iceflame89 authored May 31, 2024
2 parents d44bc28 + 5b67e5c commit fe7184f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions web_demo_2.5.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
exit()
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
else:
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(dtype=torch.float16)
model = model.to(device=device)
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.float16, device_map=device)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model.eval()

Expand Down

0 comments on commit fe7184f

Please sign in to comment.