Update README.md
Browse files
README.md
CHANGED
|
@@ -68,11 +68,11 @@ tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
|
| 68 |
model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True)
|
| 69 |
model.eval()
|
| 70 |
|
| 71 |
-
prompt = "Question: What is the capital of
|
| 72 |
input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long)
|
| 73 |
|
| 74 |
with torch.no_grad():
|
| 75 |
-
output_ids = model.generate(input_ids, max_new_tokens=
|
| 76 |
|
| 77 |
print(tokenizer.decode(output_ids[0].tolist()))
|
| 78 |
```
|
|
|
|
| 68 |
model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True)
|
| 69 |
model.eval()
|
| 70 |
|
| 71 |
+
prompt = "Question: What is the capital of France?\nAnswer:"
|
| 72 |
input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long)
|
| 73 |
|
| 74 |
with torch.no_grad():
|
| 75 |
+
output_ids = model.generate(input_ids, max_new_tokens=3, do_sample=False)
|
| 76 |
|
| 77 |
print(tokenizer.decode(output_ids[0].tolist()))
|
| 78 |
```
|