Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,9 @@ pipe = pipeline("text-generation", model="HuggingFaceH4/zephyr-7b-alpha",
|
|
14 |
torch_dtype=torch.bfloat16, device_map="auto")
|
15 |
|
16 |
|
17 |
-
def generatePrompt(
|
18 |
-
prompt =
|
19 |
-
promptdos =
|
20 |
batch = tokenizer(prompt, return_tensors="pt")
|
21 |
generated_ids = model.generate(batch["input_ids"])
|
22 |
output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
@@ -27,8 +27,12 @@ def generatePrompt(inputs):
|
|
27 |
"role": "system",
|
28 |
"content": "you are a chatbot who always responds politely and in the shortest possible way",
|
29 |
},
|
30 |
-
{
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
]
|
33 |
# https://huggingface.co/docs/transformers/main/en/chat_templating
|
34 |
final_prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
|
|
14 |
torch_dtype=torch.bfloat16, device_map="auto")
|
15 |
|
16 |
|
17 |
+
def generatePrompt(input, inputdos):
|
18 |
+
prompt = input
|
19 |
+
promptdos = inputdos
|
20 |
batch = tokenizer(prompt, return_tensors="pt")
|
21 |
generated_ids = model.generate(batch["input_ids"])
|
22 |
output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
|
|
27 |
"role": "system",
|
28 |
"content": "you are a chatbot who always responds politely and in the shortest possible way",
|
29 |
},
|
30 |
+
{
|
31 |
+
"role": "user", "content": str(new_prompt)
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"role": "user", "content": str(promptdos)
|
35 |
+
},
|
36 |
]
|
37 |
# https://huggingface.co/docs/transformers/main/en/chat_templating
|
38 |
final_prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|