Spaces:
Runtime error
Runtime error
Dagfinn1962
commited on
Commit
•
0e88e1f
1
Parent(s):
5d73a34
Update src/llm_boilers.py
Browse files- src/llm_boilers.py +5 -0
src/llm_boilers.py
CHANGED
@@ -14,6 +14,8 @@ class llm_boiler:
|
|
14 |
def __init__(self, model_id, openai_key):
|
15 |
self.model_id = model_id
|
16 |
self.openai_key = openai_key
|
|
|
|
|
17 |
for f_idx, run_function in enumerate(MODEL_FUNCTIONS):
|
18 |
if run_function.__name__.lower() in self.model_id:
|
19 |
print(
|
@@ -26,6 +28,8 @@ class llm_boiler:
|
|
26 |
f"Run function recognized for {self.model_id}: {run_function.__name__.lower()}"
|
27 |
)
|
28 |
self.run_fn = run_function
|
|
|
|
|
29 |
self.model = self.load_fn(self.model_id, self.openai_key)
|
30 |
self.name = self.run_fn.__name__.lower()
|
31 |
|
@@ -41,6 +45,7 @@ class llm_boiler:
|
|
41 |
)
|
42 |
|
43 |
|
|
|
44 |
LOAD_MODEL_FUNCTIONS = []
|
45 |
MODEL_FUNCTIONS = []
|
46 |
|
|
|
14 |
def __init__(self, model_id, openai_key):
|
15 |
self.model_id = model_id
|
16 |
self.openai_key = openai_key
|
17 |
+
self.load_fn = None # Add the load_fn attribute
|
18 |
+
self.run_fn = None # Add the run_fn attribute
|
19 |
for f_idx, run_function in enumerate(MODEL_FUNCTIONS):
|
20 |
if run_function.__name__.lower() in self.model_id:
|
21 |
print(
|
|
|
28 |
f"Run function recognized for {self.model_id}: {run_function.__name__.lower()}"
|
29 |
)
|
30 |
self.run_fn = run_function
|
31 |
+
if self.load_fn is None or self.run_fn is None:
|
32 |
+
raise ValueError("Invalid model_id")
|
33 |
self.model = self.load_fn(self.model_id, self.openai_key)
|
34 |
self.name = self.run_fn.__name__.lower()
|
35 |
|
|
|
45 |
)
|
46 |
|
47 |
|
48 |
+
|
49 |
LOAD_MODEL_FUNCTIONS = []
|
50 |
MODEL_FUNCTIONS = []
|
51 |
|