DanielWang
commited on
Commit
•
ba9db8e
1
Parent(s):
3afd21b
Update README.md
Browse filesadd repetition_penalty=1.1 to generate
README.md
CHANGED
@@ -37,7 +37,7 @@ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/baichuan-7B", trust_remo
|
|
37 |
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
|
38 |
inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
|
39 |
inputs = inputs.to('cuda:0')
|
40 |
-
pred = model.generate(**inputs, max_new_tokens=64)
|
41 |
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
|
42 |
```
|
43 |
|
|
|
37 |
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
|
38 |
inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
|
39 |
inputs = inputs.to('cuda:0')
|
40 |
+
pred = model.generate(**inputs, max_new_tokens=64,repetition_penalty=1.1)
|
41 |
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
|
42 |
```
|
43 |
|