Spaces:
Build error
Build error
Update Main.py
Browse files
Main.py
CHANGED
|
@@ -12,16 +12,17 @@ class Main:
|
|
| 12 |
EPOCHS = 6
|
| 13 |
NUM_LABELS = 12
|
| 14 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
-
MODEL_PATH = '../input/bert-base-uncased'
|
| 16 |
-
STATE_DICT = torch.load('.
|
| 17 |
-
tokenizer = BertTokenizerFast('../input/bert-base-uncased/vocab.txt', lowercase=True)
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
tags_vals = ["UNKNOWN", "O", "Name", "Degree","Skills","College Name","Email Address","Designation","Companies worked at","Graduation Year","Years of Experience","Location"]
|
| 21 |
tag2idx = {t: i for i, t in enumerate(tags_vals)}
|
| 22 |
idx2tag = {i:t for i, t in enumerate(tags_vals)}
|
| 23 |
|
| 24 |
-
data = trim_entity_spans(convert_dataturks_to_spacy('.
|
| 25 |
|
| 26 |
model = MODEL
|
| 27 |
model.to(DEVICE);
|
|
|
|
| 12 |
EPOCHS = 6
|
| 13 |
NUM_LABELS = 12
|
| 14 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
+
#MODEL_PATH = '../input/bert-base-uncased'
|
| 16 |
+
STATE_DICT = torch.load('./models/model_e6.tar', map_location=DEVICE)
|
| 17 |
+
#tokenizer = BertTokenizerFast('../input/bert-base-uncased/vocab.txt', lowercase=True)
|
| 18 |
+
tokenizer = BertTokenizerFast.from_pretrained('bert-base-cased')
|
| 19 |
+
MODEL = BertForTokenClassification.from_pretrained('bert-base-uncased', num_labels=12)
|
| 20 |
|
| 21 |
tags_vals = ["UNKNOWN", "O", "Name", "Degree","Skills","College Name","Email Address","Designation","Companies worked at","Graduation Year","Years of Experience","Location"]
|
| 22 |
tag2idx = {t: i for i, t in enumerate(tags_vals)}
|
| 23 |
idx2tag = {i:t for i, t in enumerate(tags_vals)}
|
| 24 |
|
| 25 |
+
data = trim_entity_spans(convert_dataturks_to_spacy('./data/annotated_resumes.json'))
|
| 26 |
|
| 27 |
model = MODEL
|
| 28 |
model.to(DEVICE);
|