Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,10 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 10 |
dtype=torch.float16,
|
| 11 |
device_map="auto"
|
| 12 |
)
|
| 13 |
-
|
|
|
|
| 14 |
def generate_response(prompt):
|
|
|
|
| 15 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 16 |
|
| 17 |
generation_config = GenerationConfig(
|
|
|
|
| 10 |
dtype=torch.float16,
|
| 11 |
device_map="auto"
|
| 12 |
)
|
| 13 |
+
def formatted_prompt(question)-> str:
|
| 14 |
+
return f"<|user|>\n{question}</s>\n<|assistant|>"
|
| 15 |
def generate_response(prompt):
|
| 16 |
+
prompt = formatted_prompt
|
| 17 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 18 |
|
| 19 |
generation_config = GenerationConfig(
|