Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,6 @@ import re
|
|
8 |
def paragraph_leveling(text):
|
9 |
model_name = "./trained_model/fine_tunning_encoder_v2"
|
10 |
model = AutoModel.from_pretrained(model_name)
|
11 |
-
model.to('cuda')
|
12 |
tokenizer = AutoTokenizer.from_pretrained('zzxslp/RadBERT-RoBERTa-4m')
|
13 |
|
14 |
class MLP(nn.Module):
|
@@ -24,7 +23,6 @@ def paragraph_leveling(text):
|
|
24 |
|
25 |
classifier = MLP(target_size=3, input_size=768)
|
26 |
classifier.load_state_dict(torch.load('./trained_model/fine_tunning_classifier'))
|
27 |
-
classifier.cuda()
|
28 |
classifier.eval()
|
29 |
|
30 |
output_list = []
|
@@ -46,7 +44,7 @@ def paragraph_leveling(text):
|
|
46 |
padding='max_length',
|
47 |
truncation=True,
|
48 |
max_length=120)
|
49 |
-
output = model(**train_encoding
|
50 |
output = classifier(output[1])
|
51 |
output = output[0]
|
52 |
|
|
|
8 |
def paragraph_leveling(text):
|
9 |
model_name = "./trained_model/fine_tunning_encoder_v2"
|
10 |
model = AutoModel.from_pretrained(model_name)
|
|
|
11 |
tokenizer = AutoTokenizer.from_pretrained('zzxslp/RadBERT-RoBERTa-4m')
|
12 |
|
13 |
class MLP(nn.Module):
|
|
|
23 |
|
24 |
classifier = MLP(target_size=3, input_size=768)
|
25 |
classifier.load_state_dict(torch.load('./trained_model/fine_tunning_classifier'))
|
|
|
26 |
classifier.eval()
|
27 |
|
28 |
output_list = []
|
|
|
44 |
padding='max_length',
|
45 |
truncation=True,
|
46 |
max_length=120)
|
47 |
+
output = model(**train_encoding)
|
48 |
output = classifier(output[1])
|
49 |
output = output[0]
|
50 |
|