Spaces:
Runtime error
Runtime error
vinayakdev
commited on
Commit
•
fcee375
1
Parent(s):
ae74e5f
add tokenizer
Browse files- generator.py +4 -4
generator.py
CHANGED
@@ -16,7 +16,7 @@ from transformers import (
|
|
16 |
T5TokenizerFast,
|
17 |
PreTrainedTokenizer,
|
18 |
PreTrainedModel,
|
19 |
-
|
20 |
# ElectraForQuestionAnswering
|
21 |
)
|
22 |
import torch
|
@@ -37,12 +37,12 @@ import streamlit as st
|
|
37 |
def load_model():
|
38 |
hfm = pickle.load(open('hfmodel.sav','rb'))
|
39 |
hft = T5TokenizerFast.from_pretrained("t5-base")
|
40 |
-
|
41 |
model = pickle.load(open('electra_model.sav','rb'))
|
42 |
# return hfm, hft,tok, model
|
43 |
-
return hfm, hft, model
|
44 |
|
45 |
-
hfmodel, hftokenizer, model = load_model()
|
46 |
|
47 |
def run_model(input_string, **generator_args):
|
48 |
generator_args = {
|
|
|
16 |
T5TokenizerFast,
|
17 |
PreTrainedTokenizer,
|
18 |
PreTrainedModel,
|
19 |
+
ElectraTokenizer as et,
|
20 |
# ElectraForQuestionAnswering
|
21 |
)
|
22 |
import torch
|
|
|
37 |
def load_model():
|
38 |
hfm = pickle.load(open('hfmodel.sav','rb'))
|
39 |
hft = T5TokenizerFast.from_pretrained("t5-base")
|
40 |
+
tok = et.from_pretrained("mrm8488/electra-small-finetuned-squadv2")
|
41 |
model = pickle.load(open('electra_model.sav','rb'))
|
42 |
# return hfm, hft,tok, model
|
43 |
+
return hfm, hft, tok, model
|
44 |
|
45 |
+
hfmodel, hftokenizer, tok, model = load_model()
|
46 |
|
47 |
def run_model(input_string, **generator_args):
|
48 |
generator_args = {
|