Spaces:
Build error
Build error
Update ner.py
Browse files
ner.py
CHANGED
@@ -2,8 +2,8 @@ from transformers import AutoTokenizer, AutoModelForTokenClassification
|
|
2 |
from transformers import pipeline
|
3 |
from collections import defaultdict
|
4 |
import torch
|
5 |
-
|
6 |
-
device = torch.device("cuda")
|
7 |
tokenizer = AutoTokenizer.from_pretrained("Leo97/KoELECTRA-small-v3-modu-ner")
|
8 |
model = AutoModelForTokenClassification.from_pretrained("Leo97/KoELECTRA-small-v3-modu-ner")
|
9 |
model.to(device)
|
|
|
2 |
from transformers import pipeline
|
3 |
from collections import defaultdict
|
4 |
import torch
|
5 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
6 |
+
#device = torch.device("cuda")
|
7 |
tokenizer = AutoTokenizer.from_pretrained("Leo97/KoELECTRA-small-v3-modu-ner")
|
8 |
model = AutoModelForTokenClassification.from_pretrained("Leo97/KoELECTRA-small-v3-modu-ner")
|
9 |
model.to(device)
|