DanielWang commited on
Commit
3afd21b
1 Parent(s): 262c8cb

Update README.md

Browse files

add repetition_penalty to inference code

Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -49,7 +49,7 @@ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/baichuan-7B", trust_remo
49
  model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
50
  inputs = tokenizer('Hamlet->Shakespeare\nOne Hundred Years of Solitude->', return_tensors='pt')
51
  inputs = inputs.to('cuda:0')
52
- pred = model.generate(**inputs, max_new_tokens=64)
53
  print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
54
  ```
55
 
 
49
  model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
50
  inputs = tokenizer('Hamlet->Shakespeare\nOne Hundred Years of Solitude->', return_tensors='pt')
51
  inputs = inputs.to('cuda:0')
52
+ pred = model.generate(**inputs, max_new_tokens=64,repetition_penalty=1.1)
53
  print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
54
  ```
55