transformers pytorch layoutlm token-classification generated_from_trainer dataset:funsd base_model:microsoft/layoutlm-base-uncased autotrain_compatible endpoints_compatible region:us
---
base_model: microsoft/layoutlm-base-uncased
tags:
- generated_from_trainer
datasets:
- funsd
model-index:
- name: layoutlm-funsd
  results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# layoutlm-funsd

This model is a fine-tuned version of [microsoft/layoutlm-base-uncased](https://huggingface.co/microsoft/layoutlm-base-uncased) on the funsd dataset.
It achieves the following results on the evaluation set:
- Loss: 0.7204
- Answer: {'precision': 0.7103218645948945, 'recall': 0.7911001236093943, 'f1': 0.7485380116959064, 'number': 809}
- Header: {'precision': 0.3697478991596639, 'recall': 0.3697478991596639, 'f1': 0.3697478991596639, 'number': 119}
- Question: {'precision': 0.7799126637554585, 'recall': 0.8384976525821596, 'f1': 0.8081447963800905, 'number': 1065}
- Overall Precision: 0.7284
- Overall Recall: 0.7913
- Overall F1: 0.7585
- Overall Accuracy: 0.7930

## Model description

More information needed

## Intended uses & limitations

More information needed

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 15

### Training results

| Training Loss | Epoch | Step | Validation Loss | Answer                                                                                                       | Header                                                                                                       | Question                                                                                                    | Overall Precision | Overall Recall | Overall F1 | Overall Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------:|:-----------------:|:--------------:|:----------:|:----------------:|
| 1.8258        | 1.0   | 10   | 1.6104          | {'precision': 0.03933136676499508, 'recall': 0.049443757725587144, 'f1': 0.04381161007667032, 'number': 809} | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 119}                                                  | {'precision': 0.2102076124567474, 'recall': 0.22816901408450704, 'f1': 0.21882035119315627, 'number': 1065} | 0.1302            | 0.1420         | 0.1359     | 0.3742           |
| 1.4584        | 2.0   | 20   | 1.2730          | {'precision': 0.1923509561304837, 'recall': 0.21137206427688504, 'f1': 0.20141342756183747, 'number': 809}   | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 119}                                                  | {'precision': 0.4099290780141844, 'recall': 0.5427230046948357, 'f1': 0.467070707070707, 'number': 1065}    | 0.3258            | 0.3758         | 0.3490     | 0.5734           |
| 1.1076        | 3.0   | 30   | 0.9718          | {'precision': 0.501532175689479, 'recall': 0.6069221260815822, 'f1': 0.5492170022371365, 'number': 809}      | {'precision': 0.0, 'recall': 0.0, 'f1': 0.0, 'number': 119}                                                  | {'precision': 0.5749211356466877, 'recall': 0.6845070422535211, 'f1': 0.6249464209172738, 'number': 1065}   | 0.5358            | 0.6121         | 0.5714     | 0.6890           |
| 0.8541        | 4.0   | 40   | 0.8287          | {'precision': 0.5573921028466483, 'recall': 0.7503090234857849, 'f1': 0.6396206533192834, 'number': 809}     | {'precision': 0.14893617021276595, 'recall': 0.058823529411764705, 'f1': 0.08433734939759036, 'number': 119} | {'precision': 0.6451342281879194, 'recall': 0.7220657276995305, 'f1': 0.6814355338945502, 'number': 1065}   | 0.5941            | 0.6939         | 0.6401     | 0.7420           |
| 0.7105        | 5.0   | 50   | 0.7483          | {'precision': 0.6358695652173914, 'recall': 0.723114956736712, 'f1': 0.6766917293233082, 'number': 809}      | {'precision': 0.2465753424657534, 'recall': 0.15126050420168066, 'f1': 0.18749999999999997, 'number': 119}   | {'precision': 0.6898305084745763, 'recall': 0.7643192488262911, 'f1': 0.7251670378619154, 'number': 1065}   | 0.6521            | 0.7110         | 0.6803     | 0.7618           |
| 0.6079        | 6.0   | 60   | 0.7023          | {'precision': 0.6306209850107066, 'recall': 0.7280593325092707, 'f1': 0.6758462421113023, 'number': 809}     | {'precision': 0.2875, 'recall': 0.19327731092436976, 'f1': 0.23115577889447236, 'number': 119}               | {'precision': 0.6796267496111975, 'recall': 0.8206572769953052, 'f1': 0.7435133985538068, 'number': 1065}   | 0.6461            | 0.7456         | 0.6923     | 0.7776           |
| 0.5267        | 7.0   | 70   | 0.6779          | {'precision': 0.674892703862661, 'recall': 0.7775030902348579, 'f1': 0.7225732337736933, 'number': 809}      | {'precision': 0.3, 'recall': 0.226890756302521, 'f1': 0.25837320574162675, 'number': 119}                    | {'precision': 0.717391304347826, 'recall': 0.8056338028169014, 'f1': 0.7589562140645733, 'number': 1065}    | 0.6826            | 0.7597         | 0.7191     | 0.7853           |
| 0.4735        | 8.0   | 80   | 0.6688          | {'precision': 0.6955093099671413, 'recall': 0.7849196538936959, 'f1': 0.7375145180023228, 'number': 809}     | {'precision': 0.32608695652173914, 'recall': 0.25210084033613445, 'f1': 0.2843601895734597, 'number': 119}   | {'precision': 0.7424892703862661, 'recall': 0.812206572769953, 'f1': 0.7757847533632287, 'number': 1065}    | 0.7051            | 0.7677         | 0.7350     | 0.7950           |
| 0.4196        | 9.0   | 90   | 0.6791          | {'precision': 0.6843243243243243, 'recall': 0.7824474660074165, 'f1': 0.7301038062283737, 'number': 809}     | {'precision': 0.3181818181818182, 'recall': 0.29411764705882354, 'f1': 0.3056768558951965, 'number': 119}    | {'precision': 0.7561807331628303, 'recall': 0.8328638497652582, 'f1': 0.7926720285969615, 'number': 1065}   | 0.7043            | 0.7802         | 0.7403     | 0.7937           |
| 0.3756        | 10.0  | 100  | 0.6968          | {'precision': 0.7089887640449438, 'recall': 0.7799752781211372, 'f1': 0.7427898763978811, 'number': 809}     | {'precision': 0.328, 'recall': 0.3445378151260504, 'f1': 0.33606557377049184, 'number': 119}                 | {'precision': 0.7790393013100436, 'recall': 0.8375586854460094, 'f1': 0.807239819004525, 'number': 1065}    | 0.7241            | 0.7847         | 0.7532     | 0.7947           |
| 0.3402        | 11.0  | 110  | 0.6959          | {'precision': 0.7024070021881839, 'recall': 0.7935723114956736, 'f1': 0.7452118398142775, 'number': 809}     | {'precision': 0.3416666666666667, 'recall': 0.3445378151260504, 'f1': 0.34309623430962344, 'number': 119}    | {'precision': 0.7791411042944786, 'recall': 0.8347417840375587, 'f1': 0.8059836808703537, 'number': 1065}   | 0.7228            | 0.7888         | 0.7543     | 0.7958           |
| 0.3225        | 12.0  | 120  | 0.6945          | {'precision': 0.7106430155210643, 'recall': 0.792336217552534, 'f1': 0.7492694330800702, 'number': 809}      | {'precision': 0.3644067796610169, 'recall': 0.36134453781512604, 'f1': 0.3628691983122363, 'number': 119}    | {'precision': 0.7667238421955404, 'recall': 0.8394366197183099, 'f1': 0.8014343343792021, 'number': 1065}   | 0.7219            | 0.7918         | 0.7552     | 0.7961           |
| 0.3031        | 13.0  | 130  | 0.7204          | {'precision': 0.71, 'recall': 0.7898640296662547, 'f1': 0.7478057343475717, 'number': 809}                   | {'precision': 0.35, 'recall': 0.35294117647058826, 'f1': 0.35146443514644354, 'number': 119}                 | {'precision': 0.7895204262877442, 'recall': 0.8347417840375587, 'f1': 0.8115015974440895, 'number': 1065}   | 0.7316            | 0.7878         | 0.7586     | 0.7916           |
| 0.289         | 14.0  | 140  | 0.7196          | {'precision': 0.7095709570957096, 'recall': 0.7972805933250927, 'f1': 0.750873108265425, 'number': 809}      | {'precision': 0.3826086956521739, 'recall': 0.3697478991596639, 'f1': 0.37606837606837606, 'number': 119}    | {'precision': 0.7816593886462883, 'recall': 0.8403755868544601, 'f1': 0.8099547511312217, 'number': 1065}   | 0.7303            | 0.7948         | 0.7612     | 0.7949           |
| 0.2801        | 15.0  | 150  | 0.7204          | {'precision': 0.7103218645948945, 'recall': 0.7911001236093943, 'f1': 0.7485380116959064, 'number': 809}     | {'precision': 0.3697478991596639, 'recall': 0.3697478991596639, 'f1': 0.3697478991596639, 'number': 119}     | {'precision': 0.7799126637554585, 'recall': 0.8384976525821596, 'f1': 0.8081447963800905, 'number': 1065}   | 0.7284            | 0.7913         | 0.7585     | 0.7930           |


### Framework versions

- Transformers 4.34.0
- Pytorch 2.0.1+cu118
- Datasets 2.14.5
- Tokenizers 0.14.1
