Spaces:
Runtime error
Runtime error
Commit
·
88f594a
1
Parent(s):
35601d4
Check again
Browse files- generator.py +3 -3
generator.py
CHANGED
|
@@ -40,9 +40,9 @@ def load_model():
|
|
| 40 |
# tok = att.from_pretrained("mrm8488/elect")
|
| 41 |
model = pickle.load(open('electra_model.sav','rb'))
|
| 42 |
# return hfm, hft,tok, model
|
| 43 |
-
return hfm, hft,
|
| 44 |
|
| 45 |
-
hfmodel, hftokenizer,
|
| 46 |
|
| 47 |
def run_model(input_string, **generator_args):
|
| 48 |
generator_args = {
|
|
@@ -108,7 +108,7 @@ def gen_question(inputs):
|
|
| 108 |
# gen_question(f"answer: {string_query} context: The first C program said {string_query} "). #The format of the query to generate questions
|
| 109 |
|
| 110 |
def tokenize(inputs) :
|
| 111 |
-
inputs =
|
| 112 |
inputs,
|
| 113 |
max_length="512",
|
| 114 |
add_special_tokens=True,
|
|
|
|
| 40 |
# tok = att.from_pretrained("mrm8488/elect")
|
| 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 = {
|
|
|
|
| 108 |
# gen_question(f"answer: {string_query} context: The first C program said {string_query} "). #The format of the query to generate questions
|
| 109 |
|
| 110 |
def tokenize(inputs) :
|
| 111 |
+
inputs = hftokenizer.batch_encode_plus(
|
| 112 |
inputs,
|
| 113 |
max_length="512",
|
| 114 |
add_special_tokens=True,
|