Update README.md
Browse files
README.md
CHANGED
@@ -62,6 +62,10 @@ import torch
|
|
62 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
63 |
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints", revision="train_02200B", use_fast=False, trust_remote_code=True)
|
64 |
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints", revision="train_02200B", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
|
|
|
|
|
|
|
|
65 |
```
|
66 |
|
67 |
# <span id="Benchmark">Benchmark 结果/Benchmark Evaluation</span>
|
|
|
62 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
63 |
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints", revision="train_02200B", use_fast=False, trust_remote_code=True)
|
64 |
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints", revision="train_02200B", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
65 |
+
inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
|
66 |
+
inputs = inputs.to('cuda:0')
|
67 |
+
pred = model.generate(**inputs, max_new_tokens=64, repetition_penalty=1.1)
|
68 |
+
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
|
69 |
```
|
70 |
|
71 |
# <span id="Benchmark">Benchmark 结果/Benchmark Evaluation</span>
|