Spaces:
Sleeping
Sleeping
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import transformers
|
3 |
from model_config import PragFormerConfig
|
4 |
-
from model import
|
5 |
from simpletransformers.classification import ClassificationModel, ClassificationArgs
|
6 |
import torch
|
7 |
import json
|
@@ -11,9 +11,9 @@ deep_scc_model_args = ClassificationArgs(num_train_epochs=10,max_seq_length=300,
|
|
11 |
deep_scc_model = ClassificationModel("roberta", "NTUYG/DeepSCC-RoBERTa", num_labels=19, args=deep_scc_model_args, use_cuda=False)
|
12 |
|
13 |
pragformer_config = PragFormerConfig.from_pretrained("Pragformer/PragFormer", trust_remote_code=True)
|
14 |
-
pragformer =
|
15 |
-
pragformer_private =
|
16 |
-
pragformer_reduction =
|
17 |
|
18 |
|
19 |
#Event Listeners
|
|
|
1 |
import gradio as gr
|
2 |
import transformers
|
3 |
from model_config import PragFormerConfig
|
4 |
+
from model import Pragformer
|
5 |
from simpletransformers.classification import ClassificationModel, ClassificationArgs
|
6 |
import torch
|
7 |
import json
|
|
|
11 |
deep_scc_model = ClassificationModel("roberta", "NTUYG/DeepSCC-RoBERTa", num_labels=19, args=deep_scc_model_args, use_cuda=False)
|
12 |
|
13 |
pragformer_config = PragFormerConfig.from_pretrained("Pragformer/PragFormer", trust_remote_code=True)
|
14 |
+
pragformer = Pragformer.from_pretrained("Pragformer/PragFormer", config=pragformer_config, trust_remote_code=True)
|
15 |
+
pragformer_private = Pragformer.from_pretrained("Pragformer/PragFormer_private", config=pragformer_config, trust_remote_code=True)
|
16 |
+
pragformer_reduction = Pragformer.from_pretrained("Pragformer/PragFormer_reduction", config=pragformer_config, trust_remote_code=True)
|
17 |
|
18 |
|
19 |
#Event Listeners
|
model.py
CHANGED
@@ -5,7 +5,7 @@ from model_config import PragFormerConfig
|
|
5 |
|
6 |
|
7 |
|
8 |
-
class
|
9 |
config_class = PragFormerConfig
|
10 |
|
11 |
def __init__(self, config):
|
|
|
5 |
|
6 |
|
7 |
|
8 |
+
class Pragformer(PreTrainedModel): #(BertPreTrainedModel):
|
9 |
config_class = PragFormerConfig
|
10 |
|
11 |
def __init__(self, config):
|