Juslin Jay commited on
Commit ·
5b026ad
1
Parent(s): 38ba283
Update model_loader.py
Browse files- app/model_loader.py +2 -2
app/model_loader.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from transformers import
|
| 2 |
|
| 3 |
# Load tokenizer and model once during startup
|
| 4 |
try:
|
|
@@ -9,7 +9,7 @@ try:
|
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir=cache_dir)
|
| 10 |
|
| 11 |
print(f"Loading QA model from {model_name}...")
|
| 12 |
-
model =
|
| 13 |
|
| 14 |
print("QA Model and tokenizer loaded successfully!")
|
| 15 |
except Exception as e:
|
|
|
|
| 1 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 2 |
|
| 3 |
# Load tokenizer and model once during startup
|
| 4 |
try:
|
|
|
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir=cache_dir)
|
| 10 |
|
| 11 |
print(f"Loading QA model from {model_name}...")
|
| 12 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name, cache_dir=cache_dir)
|
| 13 |
|
| 14 |
print("QA Model and tokenizer loaded successfully!")
|
| 15 |
except Exception as e:
|