pierreguillou commited on
Commit
5811cb2
1 Parent(s): ed9f2e9

Update files/functions.py

Browse files
Files changed (1) hide show
  1. files/functions.py +9 -0
files/functions.py CHANGED
@@ -172,6 +172,15 @@ feature_extractor = LayoutLMv2FeatureExtractor(apply_ocr=False)
172
  from transformers import AutoTokenizer
173
  tokenizer_layoutxlm = AutoTokenizer.from_pretrained(tokenizer_id_layoutxlm)
174
 
 
 
 
 
 
 
 
 
 
175
  ## General
176
 
177
  # get text and bounding boxes from an image
 
172
  from transformers import AutoTokenizer
173
  tokenizer_layoutxlm = AutoTokenizer.from_pretrained(tokenizer_id_layoutxlm)
174
 
175
+ # get labels
176
+ id2label_lilt = model_lilt.config.id2label
177
+ label2id_lilt = model_lilt.config.label2id
178
+ num_labels_lilt = len(id2label_lilt)
179
+
180
+ id2label_layoutxlm = model_layoutxlm.config.id2label
181
+ label2id_layoutxlm = model_layoutxlm.config.label2id
182
+ num_labels_layoutxlm = len(id2label_layoutxlm)
183
+
184
  ## General
185
 
186
  # get text and bounding boxes from an image