Skip to content

Commit

Permalink
Add aquila2_hf
Browse files Browse the repository at this point in the history
Signed-off-by: ldwang <[email protected]>
  • Loading branch information
ldwang committed Oct 17, 2023
1 parent 89b8960 commit c8ef199
Show file tree
Hide file tree
Showing 3 changed files with 464 additions and 0 deletions.
14 changes: 14 additions & 0 deletions flagai/model/aquila2_hf/AquilaChat2-34B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
device = torch.device("cuda:0")
model_info = "BAAI/AquilaChat2-34B"
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()
model.to(device)
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, device=device,
model_name="AquilaChat2-34B")
print(out)
14 changes: 14 additions & 0 deletions flagai/model/aquila2_hf/AquilaChat2-7B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
device = torch.device("cuda:0")
model_info = "BAAI/AquilaChat2-7B"
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()
model.to(device)
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, device=device,
model_name="AquilaChat2-7B")
print(out)
Loading

0 comments on commit c8ef199

Please sign in to comment.