pseudotensor
commited on
Commit
•
5354396
1
Parent(s):
bff61a4
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
AquilaChat2 long-text chat model [AquilaChat2-34B-16k](https://github.com/FlagAI-Open/Aquila2#base-model-performance).
|
2 |
+
|
3 |
+
Inference
|
4 |
+
```
|
5 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
6 |
+
import torch
|
7 |
+
device = torch.device("cuda:0")
|
8 |
+
model_info = "BAAI/AquilaChat2-34B-16k"
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
|
10 |
+
model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16)
|
11 |
+
model.eval()
|
12 |
+
model.to(device)
|
13 |
+
text = "请给出10个要到北京旅游的理由。"
|
14 |
+
from predict import predict
|
15 |
+
out = predict(model, text, tokenizer=tokenizer, max_gen_len=200, top_p=0.95,
|
16 |
+
seed=1234, topk=100, temperature=0.9, sft=True, device=device,
|
17 |
+
model_name="AquilaChat2-34B-16K")
|
18 |
+
print(out)
|
19 |
+
```
|
20 |
+
License
|
21 |
+
Aquila2 series open-source model is licensed under BAAI Aquila Model Licence Agreement
|