Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ def create_prompt_with_chat_format(messages, bos="<s>", eos="</s>", add_bos=True
|
|
48 |
formatted_text = bos + formatted_text if add_bos else formatted_text
|
49 |
return formatted_text
|
50 |
|
51 |
-
|
52 |
def inference(input_prompts, model, tokenizer, system_prompt="System: "):
|
53 |
output_texts = []
|
|
|
54 |
for input_prompt in input_prompts:
|
55 |
formatted_query = create_prompt_with_chat_format([{"role": "user", "content": input_prompt}], add_bos=False, system_prompt=system_prompt)
|
56 |
encodings = tokenizer(formatted_query, padding=True, return_tensors="pt")
|
@@ -65,6 +65,7 @@ def inference(input_prompts, model, tokenizer, system_prompt="System: "):
|
|
65 |
|
66 |
|
67 |
|
|
|
68 |
examples = [
|
69 |
["मुझे अपने करियर के बारे में सुझाव दो", "मैं कैसे अध्ययन कर सकता हूँ?"],
|
70 |
["कृपया मुझे एक कहानी सुनाएं", "ताजमहल के बारे में कुछ बताएं"],
|
|
|
48 |
formatted_text = bos + formatted_text if add_bos else formatted_text
|
49 |
return formatted_text
|
50 |
|
|
|
51 |
def inference(input_prompts, model, tokenizer, system_prompt="System: "):
|
52 |
output_texts = []
|
53 |
+
model = model.to(device) # Move the model to the same device as the input data
|
54 |
for input_prompt in input_prompts:
|
55 |
formatted_query = create_prompt_with_chat_format([{"role": "user", "content": input_prompt}], add_bos=False, system_prompt=system_prompt)
|
56 |
encodings = tokenizer(formatted_query, padding=True, return_tensors="pt")
|
|
|
65 |
|
66 |
|
67 |
|
68 |
+
|
69 |
examples = [
|
70 |
["मुझे अपने करियर के बारे में सुझाव दो", "मैं कैसे अध्ययन कर सकता हूँ?"],
|
71 |
["कृपया मुझे एक कहानी सुनाएं", "ताजमहल के बारे में कुछ बताएं"],
|