Spaces:
Runtime error
Runtime error
fix NameError
Browse files- evaluate_data.py +2 -2
evaluate_data.py
CHANGED
@@ -33,7 +33,7 @@ with open(feature_path, 'rb') as f:
|
|
33 |
ner_model = AutoModelForTokenClassification.from_pretrained(checkpoint)
|
34 |
|
35 |
|
36 |
-
|
37 |
tokenize_and_align_labels,
|
38 |
batched=True,
|
39 |
batch_size=None,
|
@@ -52,7 +52,7 @@ def collate_fn(data):
|
|
52 |
|
53 |
return input_ids, token_type_ids, attention_mask, labels
|
54 |
|
55 |
-
loader = torch.utils.data.DataLoader(tokenized_test, batch_size=32, collate_fn=
|
56 |
device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
|
57 |
|
58 |
ner_model = ner_model.eval()
|
|
|
33 |
ner_model = AutoModelForTokenClassification.from_pretrained(checkpoint)
|
34 |
|
35 |
|
36 |
+
tokenized_test = test.map(
|
37 |
tokenize_and_align_labels,
|
38 |
batched=True,
|
39 |
batch_size=None,
|
|
|
52 |
|
53 |
return input_ids, token_type_ids, attention_mask, labels
|
54 |
|
55 |
+
loader = torch.utils.data.DataLoader(tokenized_test, batch_size=32, collate_fn=collate_fn)
|
56 |
device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
|
57 |
|
58 |
ner_model = ner_model.eval()
|