Freddolin commited on
Commit
58c4724
·
verified ·
1 Parent(s): b5d03d2

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +13 -1
agent.py CHANGED
@@ -9,9 +9,21 @@ If you are asked for a string, don't use articles, neither abbreviations (e.g. f
9
  If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
10
  """
11
 
 
 
 
 
12
  class GaiaAgent:
13
  def __init__(self, model_id="tiiuae/falcon-rw-1b"):
14
- self.generator = pipeline("text-generation", model=model_id, tokenizer=model_id, max_new_tokens=512)
 
 
 
 
 
 
 
 
15
 
16
  def __call__(self, question: str) -> tuple[str, str]:
17
  try:
 
9
  If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
10
  """
11
 
12
+ from transformers import pipeline
13
+
14
+ SYSTEM_PROMPT = """...""" # oförändrat
15
+
16
  class GaiaAgent:
17
  def __init__(self, model_id="tiiuae/falcon-rw-1b"):
18
+ self.generator = pipeline(
19
+ "text-generation",
20
+ model=model_id,
21
+ tokenizer=model_id,
22
+ max_new_tokens=512,
23
+ device="cpu", # viktigt!
24
+ return_full_text=False
25
+ )
26
+
27
 
28
  def __call__(self, question: str) -> tuple[str, str]:
29
  try: