wt002 commited on
Commit
46ff440
·
verified ·
1 Parent(s): f005d9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
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.2,
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
- model = HfApiModel(
271
- temperature=0.1,
 
 
 
 
 
 
 
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 an explanation of your reasoning, step by step, to arrive at the answer.
291
- Then, return your final answer in a single line, formatted as follows: "FINAL ANSWER: [YOUR FINAL ANSWER]".
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(