Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,22 +6,15 @@ from transformers import AutoModelForTokenClassification
|
|
| 6 |
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 7 |
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
learning_rate = 3e-5
|
| 11 |
-
batch_size = 16
|
| 12 |
-
epochs = 3
|
| 13 |
max_seq_length = 512
|
| 14 |
-
warmup_steps = 100
|
| 15 |
-
weight_decay = 0.01
|
| 16 |
-
dropout_prob = 0.1
|
| 17 |
-
gradient_clip_value = 1.0
|
| 18 |
q_n_a_model_name = "deepset/roberta-base-squad2"
|
| 19 |
q_n_a_model = AutoModelForQuestionAnswering.from_pretrained(q_n_a_model_name)
|
| 20 |
q_n_a_tokenizer = AutoTokenizer.from_pretrained(q_n_a_model_name)
|
| 21 |
|
| 22 |
-
|
| 23 |
-
classification_tokenizer = DistilBertTokenizer.from_pretrained(
|
| 24 |
-
classification_model = DistilBertForSequenceClassification.from_pretrained(
|
| 25 |
|
| 26 |
|
| 27 |
|
|
|
|
| 6 |
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 7 |
|
| 8 |
|
| 9 |
+
# QnA Model (Context based)
|
|
|
|
|
|
|
|
|
|
| 10 |
max_seq_length = 512
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
q_n_a_model_name = "deepset/roberta-base-squad2"
|
| 12 |
q_n_a_model = AutoModelForQuestionAnswering.from_pretrained(q_n_a_model_name)
|
| 13 |
q_n_a_tokenizer = AutoTokenizer.from_pretrained(q_n_a_model_name)
|
| 14 |
|
| 15 |
+
classification_model_name = "distilbert-base-uncased"
|
| 16 |
+
classification_tokenizer = DistilBertTokenizer.from_pretrained(classification_model_name)
|
| 17 |
+
classification_model = DistilBertForSequenceClassification.from_pretrained(classification_model_name)
|
| 18 |
|
| 19 |
|
| 20 |
|