Locutusque
commited on
Commit
•
bf18bb2
1
Parent(s):
045ee35
Update README.md
Browse files
README.md
CHANGED
@@ -94,7 +94,7 @@ model.load_state_dict(torch.load("path/to/model"))
|
|
94 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
95 |
model.to(device)
|
96 |
def generate_text(model, tokenizer, prompt, max_length=1024):
|
97 |
-
prompt = f'<|
|
98 |
input_ids = tokenizer.encode(prompt, add_special_tokens=True, return_tensors="pt").to(device)
|
99 |
attention_mask = torch.ones_like(input_ids).to(device)
|
100 |
output = model.generate(input_ids,
|
|
|
94 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
95 |
model.to(device)
|
96 |
def generate_text(model, tokenizer, prompt, max_length=1024):
|
97 |
+
prompt = f'<|USER|> {prompt} <|ASSISTANT|> '
|
98 |
input_ids = tokenizer.encode(prompt, add_special_tokens=True, return_tensors="pt").to(device)
|
99 |
attention_mask = torch.ones_like(input_ids).to(device)
|
100 |
output = model.generate(input_ids,
|