thepinkdrummer
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -44,8 +44,10 @@ model = PeftModel.from_pretrained(base_model, peft_model_name)
|
|
44 |
|
45 |
|
46 |
import torch
|
|
|
47 |
def chat_with_model(prompt, max_length=512):
|
48 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
|
49 |
with torch.no_grad():
|
50 |
output = model.generate(
|
51 |
inputs['input_ids'],
|
@@ -60,6 +62,7 @@ def chat_with_model(prompt, max_length=512):
|
|
60 |
)
|
61 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
62 |
return response
|
|
|
63 |
user_input = "Hello! How are you?"
|
64 |
response = chat_with_model(user_input)
|
65 |
print(response)
|
|
|
44 |
|
45 |
|
46 |
import torch
|
47 |
+
|
48 |
def chat_with_model(prompt, max_length=512):
|
49 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
50 |
+
|
51 |
with torch.no_grad():
|
52 |
output = model.generate(
|
53 |
inputs['input_ids'],
|
|
|
62 |
)
|
63 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
64 |
return response
|
65 |
+
|
66 |
user_input = "Hello! How are you?"
|
67 |
response = chat_with_model(user_input)
|
68 |
print(response)
|