julien-c HF staff commited on
Commit
948aa11
Β·
1 Parent(s): 99d07d0

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/mrm8488/bert-small-finetuned-typo-detection/README.md

Files changed (1) hide show
  1. README.md +72 -0
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ thumbnail:
4
+ ---
5
+
6
+ # BERT SMALL + Typo Detection βœβŒβœβœ”
7
+
8
+ [BERT SMALL](https://huggingface.co/google/bert_uncased_L-4_H-512_A-8) fine-tuned on [GitHub Typo Corpus](https://github.com/mhagiwara/github-typo-corpus) for **typo detection** (using *NER* style)
9
+
10
+ ## Details of the downstream task (Typo detection as NER)
11
+
12
+ - Dataset: [GitHub Typo Corpus](https://github.com/mhagiwara/github-typo-corpus) πŸ“š
13
+
14
+ - [Fine-tune script on NER dataset provided by Huggingface](https://github.com/huggingface/transformers/blob/master/examples/token-classification/run_ner_old.py) πŸ‹οΈβ€β™‚οΈ
15
+
16
+ ## Metrics on test set πŸ“‹
17
+
18
+ | Metric | # score |
19
+ | :-------: | :-------: |
20
+ | F1 | **89.12** |
21
+ | Precision | **93.82** |
22
+ | Recall | **84.87** |
23
+
24
+ ## Model in action πŸ”¨
25
+
26
+ Fast usage with **pipelines** πŸ§ͺ
27
+
28
+ ```python
29
+ from transformers import pipeline
30
+
31
+ typo_checker = pipeline(
32
+ "ner",
33
+ model="mrm8488/bert-small-finetuned-typo-detection",
34
+ tokenizer="mrm8488/bert-small-finetuned-typo-detection"
35
+ )
36
+
37
+ result = typo_checker("here there is an error in coment")
38
+ result[1:-1]
39
+
40
+ # Output:
41
+ [{'entity': 'ok', 'score': 0.9021041989326477, 'word': 'here'},
42
+ {'entity': 'ok', 'score': 0.7975626587867737, 'word': 'there'},
43
+ {'entity': 'ok', 'score': 0.8596242070198059, 'word': 'is'},
44
+ {'entity': 'ok', 'score': 0.7071516513824463, 'word': 'an'},
45
+ {'entity': 'ok', 'score': 0.943381130695343, 'word': 'error'},
46
+ {'entity': 'ok', 'score': 0.8047608733177185, 'word': 'in'},
47
+ {'entity': 'ok', 'score': 0.8240702152252197, 'word': 'come'},
48
+ {'entity': 'typo', 'score': 0.5004884004592896, 'word': '##nt'}]
49
+ ```
50
+
51
+ It worksπŸŽ‰! we typed ```coment``` instead of ```comment```
52
+
53
+ Let's try with another example
54
+
55
+ ```python
56
+ result = typo_checker("Adddd validation midelware")
57
+ result[1:-1]
58
+
59
+ # Output:
60
+ [{'entity': 'ok', 'score': 0.7128152847290039, 'word': 'add'},
61
+ {'entity': 'typo', 'score': 0.5388424396514893, 'word': '##dd'},
62
+ {'entity': 'ok', 'score': 0.94792640209198, 'word': 'validation'},
63
+ {'entity': 'typo', 'score': 0.5839331746101379, 'word': 'mid'},
64
+ {'entity': 'ok', 'score': 0.5195121765136719, 'word': '##el'},
65
+ {'entity': 'ok', 'score': 0.7222476601600647, 'word': '##ware'}]
66
+ ```
67
+ Yeah! We typed wrong ```Add and middleware```
68
+
69
+
70
+ > Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488)
71
+
72
+ > Made with <span style="color: #e25555;">&hearts;</span> in Spain