pierreguillou
commited on
Commit
·
4501585
1
Parent(s):
6dfa440
Update app.py
Browse files
app.py
CHANGED
@@ -52,15 +52,15 @@ os.system('python -m pip install --upgrade pip')
|
|
52 |
|
53 |
## model / feature extractor / tokenizer
|
54 |
|
55 |
-
from transformers import LayoutLMv2ForTokenClassification # LayoutXLMTokenizerFast,
|
56 |
-
|
57 |
import torch
|
58 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
59 |
|
|
|
60 |
# model
|
|
|
61 |
# tokenizer = LayoutXLMTokenizerFast.from_pretrained(model_id)
|
62 |
-
|
63 |
-
|
64 |
|
65 |
# feature extractor
|
66 |
from transformers import LayoutLMv2FeatureExtractor
|
|
|
52 |
|
53 |
## model / feature extractor / tokenizer
|
54 |
|
|
|
|
|
55 |
import torch
|
56 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
57 |
|
58 |
+
from transformers import LayoutLMv2ForTokenClassification # LayoutXLMTokenizerFast,
|
59 |
# model
|
60 |
+
model_id = "pierreguillou/lilt-xlm-roberta-base-finetuned-with-DocLayNet-base-at-linelevel-ml384"
|
61 |
# tokenizer = LayoutXLMTokenizerFast.from_pretrained(model_id)
|
62 |
+
model2 = LayoutLMv2ForTokenClassification.from_pretrained(model_id);
|
63 |
+
model2.to(device);
|
64 |
|
65 |
# feature extractor
|
66 |
from transformers import LayoutLMv2FeatureExtractor
|