Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,30 +53,14 @@ class CodeLlamaTool(Tool):
|
|
53 |
model=self.model,
|
54 |
tokenizer=self.tokenizer,
|
55 |
max_new_tokens=512,
|
56 |
-
|
|
|
57 |
)
|
58 |
|
59 |
def forward(self, question: str) -> str:
|
60 |
prompt = f"""
|
61 |
-
You are an
|
62 |
-
|
63 |
-
Instructions:
|
64 |
-
- Solve step-by-step.
|
65 |
-
- Wrap any code in <tool>...</tool>.
|
66 |
-
- End your answer with <final>...</final> with the final result only.
|
67 |
-
|
68 |
-
Example:
|
69 |
-
Question: What is 3 times the square root of 49?
|
70 |
-
Answer:
|
71 |
-
<tool>
|
72 |
-
import math
|
73 |
-
print(3 * math.sqrt(49))
|
74 |
-
</tool>
|
75 |
-
<final>21.0</final>
|
76 |
-
|
77 |
-
Now solve:
|
78 |
-
Question: {question}
|
79 |
-
Answer:
|
80 |
"""
|
81 |
|
82 |
result = self.pipeline(prompt)[0]["generated_text"]
|
|
|
53 |
model=self.model,
|
54 |
tokenizer=self.tokenizer,
|
55 |
max_new_tokens=512,
|
56 |
+
truncation=True,
|
57 |
+
temperature=0.1
|
58 |
)
|
59 |
|
60 |
def forward(self, question: str) -> str:
|
61 |
prompt = f"""
|
62 |
+
"You are an assistant. Solve step-by-step. "
|
63 |
+
"End your answer with a concise answer ina few words: FINAL ANSWER: [value]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
"""
|
65 |
|
66 |
result = self.pipeline(prompt)[0]["generated_text"]
|