Spaces:
Runtime error
Runtime error
Commit
·
0121498
1
Parent(s):
988981a
pydantic class fix
Browse files- qa_engine/qa_engine.py +7 -0
- tests/qa_engine/test_qa_engine.py +11 -0
qa_engine/qa_engine.py
CHANGED
|
@@ -23,6 +23,7 @@ from qa_engine.mocks import MockLocalBinaryModel
|
|
| 23 |
|
| 24 |
class LocalBinaryModel(LLM):
|
| 25 |
model_id: str = None
|
|
|
|
| 26 |
llm: None = None
|
| 27 |
|
| 28 |
def __init__(self, config: Config):
|
|
@@ -56,6 +57,12 @@ class LocalBinaryModel(LLM):
|
|
| 56 |
|
| 57 |
class TransformersPipelineModel(LLM):
|
| 58 |
model_id: str = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
pipeline: str = None
|
| 60 |
|
| 61 |
def __init__(self, config: Config):
|
|
|
|
| 23 |
|
| 24 |
class LocalBinaryModel(LLM):
|
| 25 |
model_id: str = None
|
| 26 |
+
model_path: str = None
|
| 27 |
llm: None = None
|
| 28 |
|
| 29 |
def __init__(self, config: Config):
|
|
|
|
| 57 |
|
| 58 |
class TransformersPipelineModel(LLM):
|
| 59 |
model_id: str = None
|
| 60 |
+
min_new_tokens: int = None
|
| 61 |
+
max_new_tokens: int = None
|
| 62 |
+
temperature: float = None
|
| 63 |
+
top_k: int = None
|
| 64 |
+
top_p: float = None
|
| 65 |
+
do_sample: bool = None
|
| 66 |
pipeline: str = None
|
| 67 |
|
| 68 |
def __init__(self, config: Config):
|
tests/qa_engine/test_qa_engine.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from qa_engine import Config, QAEngine
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_qa_engine():
|
| 6 |
+
config = Config()
|
| 7 |
+
qa_engine = QAEngine(config=config)
|
| 8 |
+
response = qa_engine.get_response(
|
| 9 |
+
question='What is the capital of Poland?',
|
| 10 |
+
)
|
| 11 |
+
assert response.get_answer() == 'Warsaw'
|