-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ldwang <[email protected]>
- Loading branch information
ldwang
committed
Nov 28, 2023
1 parent
994ee63
commit 5f35072
Showing
4 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from transformers import AutoTokenizer, AutoModelForCausalLM | ||
import torch | ||
model_info = "BAAI/AquilaChat2-70B" | ||
tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True) | ||
model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16) | ||
model.eval() | ||
text = "请给出10个要到北京旅游的理由。" | ||
from predict import predict | ||
out = predict(model, text, tokenizer=tokenizer, max_gen_len=200, top_p=0.95, | ||
seed=1234, topk=100, temperature=0.9, sft=True, | ||
model_name="AquilaChat2-70B") | ||
print(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters