s-JoL commited on
Commit
fa88072
1 Parent(s): 14c6851

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -1
README.md CHANGED
@@ -58,7 +58,11 @@ In the Baichuan 2 series models, we have utilized the new feature `F.scaled_dot_
58
  import torch
59
  from transformers import AutoModelForCausalLM, AutoTokenizer
60
  tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan2-13B-Base", use_fast=False, trust_remote_code=True)
61
- model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan2-13B-Base", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
 
 
 
 
62
  ```
63
 
64
  # <span id="Benchmark">Benchmark 结果/Benchmark Evaluation</span>
 
58
  import torch
59
  from transformers import AutoModelForCausalLM, AutoTokenizer
60
  tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan2-13B-Base", use_fast=False, trust_remote_code=True)
61
+ model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan2-13B-Base", device_map="auto", trust_remote_code=True)
62
+ inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
63
+ inputs = inputs.to('cuda:0')
64
+ pred = model.generate(**inputs, max_new_tokens=64, repetition_penalty=1.1)
65
+ print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
66
  ```
67
 
68
  # <span id="Benchmark">Benchmark 结果/Benchmark Evaluation</span>