Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|