Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,8 +57,8 @@ class CodeLlamaTool(Tool):
|
|
57 |
"text-generation",
|
58 |
model=self.model,
|
59 |
tokenizer=self.tokenizer,
|
60 |
-
max_new_tokens=512
|
61 |
-
temperature=0.
|
62 |
truncation=True
|
63 |
)
|
64 |
|
@@ -267,8 +267,15 @@ class VideoTranscriptionTool(Tool):
|
|
267 |
class BasicAgent:
|
268 |
def __init__(self):
|
269 |
token = os.environ.get("HF_API_TOKEN")
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
token=token
|
273 |
)
|
274 |
|
@@ -287,12 +294,8 @@ class BasicAgent:
|
|
287 |
|
288 |
system_prompt = f"""
|
289 |
You are my general AI assistant. Your task is to answer the question I asked.
|
290 |
-
First, provide
|
291 |
-
|
292 |
-
[YOUR FINAL ANSWER] should be a number, a string, or a comma-separated list of numbers and/or strings, depending on the question.
|
293 |
-
If the answer is a number, do not use commas or units (e.g., $, %) unless specified.
|
294 |
-
If the answer is a string, do not use articles or abbreviations (e.g., for cities), and write digits in plain text unless specified.
|
295 |
-
If the answer is a comma-separated list, apply the above rules for each element based on whether it is a number or a string.
|
296 |
"""
|
297 |
|
298 |
self.agent = CodeAgent(
|
|
|
57 |
"text-generation",
|
58 |
model=self.model,
|
59 |
tokenizer=self.tokenizer,
|
60 |
+
max_new_tokens=256, # 512
|
61 |
+
temperature=0.0,
|
62 |
truncation=True
|
63 |
)
|
64 |
|
|
|
267 |
class BasicAgent:
|
268 |
def __init__(self):
|
269 |
token = os.environ.get("HF_API_TOKEN")
|
270 |
+
|
271 |
+
# Initialize tokenizer
|
272 |
+
self.model_id = "codellama/CodeLlama-7b-Instruct-hf"
|
273 |
+
self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, token=token)
|
274 |
+
|
275 |
+
# Model (e.g., HfApiModel or other)
|
276 |
+
self.model = HfApiModel(
|
277 |
+
model=self.model_id,
|
278 |
+
temperature=0.0,
|
279 |
token=token
|
280 |
)
|
281 |
|
|
|
294 |
|
295 |
system_prompt = f"""
|
296 |
You are my general AI assistant. Your task is to answer the question I asked.
|
297 |
+
First, provide reasoning. Then return: FINAL ANSWER: [your answer].
|
298 |
+
Answer should be a short string, number, or comma-separated list. Keep it brief.
|
|
|
|
|
|
|
|
|
299 |
"""
|
300 |
|
301 |
self.agent = CodeAgent(
|