EnderAir commited on
Commit
ab704d6
·
verified ·
1 Parent(s): 9bf4da4

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. config.json +63 -0
  2. generation_config.json +9 -0
  3. model.safetensors +3 -0
  4. readme.md +122 -0
  5. tokenizer.json +0 -0
  6. tokenizer_config.json +114 -0
config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "T5ForConditionalGeneration"
4
+ ],
5
+ "classifier_dropout": 0.0,
6
+ "d_ff": 2048,
7
+ "d_kv": 64,
8
+ "d_model": 512,
9
+ "decoder_start_token_id": 0,
10
+ "dense_act_fn": "relu",
11
+ "dropout_rate": 0.1,
12
+ "dtype": "float32",
13
+ "eos_token_id": 1,
14
+ "feed_forward_proj": "relu",
15
+ "initializer_factor": 1.0,
16
+ "is_decoder": false,
17
+ "is_encoder_decoder": true,
18
+ "is_gated_act": false,
19
+ "layer_norm_epsilon": 1e-06,
20
+ "model_type": "t5",
21
+ "n_positions": 512,
22
+ "num_decoder_layers": 6,
23
+ "num_heads": 8,
24
+ "num_layers": 6,
25
+ "output_past": true,
26
+ "pad_token_id": 0,
27
+ "relative_attention_max_distance": 128,
28
+ "relative_attention_num_buckets": 32,
29
+ "scale_decoder_outputs": true,
30
+ "task_specific_params": {
31
+ "summarization": {
32
+ "early_stopping": true,
33
+ "length_penalty": 2.0,
34
+ "max_length": 200,
35
+ "min_length": 30,
36
+ "no_repeat_ngram_size": 3,
37
+ "num_beams": 4,
38
+ "prefix": "summarize: "
39
+ },
40
+ "translation_en_to_de": {
41
+ "early_stopping": true,
42
+ "max_length": 300,
43
+ "num_beams": 4,
44
+ "prefix": "translate English to German: "
45
+ },
46
+ "translation_en_to_fr": {
47
+ "early_stopping": true,
48
+ "max_length": 300,
49
+ "num_beams": 4,
50
+ "prefix": "translate English to French: "
51
+ },
52
+ "translation_en_to_ro": {
53
+ "early_stopping": true,
54
+ "max_length": 300,
55
+ "num_beams": 4,
56
+ "prefix": "translate English to Romanian: "
57
+ }
58
+ },
59
+ "tie_word_embeddings": true,
60
+ "transformers_version": "5.12.1",
61
+ "use_cache": false,
62
+ "vocab_size": 32128
63
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "decoder_start_token_id": 0,
4
+ "eos_token_id": [
5
+ 1
6
+ ],
7
+ "pad_token_id": 0,
8
+ "transformers_version": "5.12.1"
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cd03fcb466e70bd06edbf83961f21fcb8a92ba11eeb0b21ad7c36156569bbc0
3
+ size 242041896
readme.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ \---
2
+
3
+ license: apache-2.0
4
+
5
+ base\_model: t5-small
6
+
7
+ tags:
8
+
9
+   - grammar-correction
10
+
11
+   - t5
12
+
13
+   - text2text-generation
14
+
15
+ language:
16
+
17
+   - en
18
+
19
+ \---
20
+
21
+
22
+
23
+ \# Proximity Grammar Corrector (T5-small)
24
+
25
+
26
+
27
+ A small fine-tuned \[T5-small](https://huggingface.co/t5-small) model for \*\*English grammar correction\*\*. Part of the \[Proximity](https://github.com/) project — a lightweight background tool that fixes grammar via a global hotkey.
28
+
29
+
30
+
31
+ \## What this model does
32
+
33
+
34
+
35
+ Takes a sentence with grammar mistakes and outputs a corrected version. Examples:
36
+
37
+
38
+
39
+ | Input | Output |
40
+
41
+ |---|---|
42
+
43
+ | She dont like going to the store. | She doesn't like going to the store. |
44
+
45
+ | He are moving here. | He is moving here. |
46
+
47
+ | I has went to the market yesterday. | I have gone to the market yesterday. |
48
+
49
+ | They was happy about they new house. | They were happy about their new house. |
50
+
51
+
52
+
53
+ \## What this model does NOT do
54
+
55
+
56
+
57
+ \- It is \*\*not a chat model\*\*. It will not hold a conversation or answer questions.
58
+
59
+ \- It is \*\*not a style/tone rewriter\*\*. It targets grammatical correctness, not voice or wording improvements.
60
+
61
+ \- It struggles with some irregular verb forms not well represented in training data (e.g. "drinked" instead of "drank" was not corrected in testing).
62
+
63
+ \- It is trained on a small dataset (\~6,000 sentence pairs), so coverage of rare or complex grammatical errors is limited.
64
+
65
+
66
+
67
+ \## Training details
68
+
69
+
70
+
71
+ \- \*\*Base model:\*\* t5-small (\~60M parameters)
72
+
73
+ \- \*\*Dataset:\*\* \[Owishiboo/grammar-correction](https://huggingface.co/datasets/Owishiboo/grammar-correction) (\~6,000 ungrammatical → grammatical sentence pairs)
74
+
75
+ \- \*\*Epochs:\*\* 6
76
+
77
+ \- \*\*Final train loss:\*\* 0.1685
78
+
79
+ \- \*\*Final eval loss:\*\* \~0.186
80
+
81
+
82
+
83
+ \## Usage
84
+
85
+
86
+
87
+ ```python
88
+
89
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
90
+
91
+
92
+
93
+ tokenizer = T5Tokenizer.from\_pretrained("EnderAir/proximity")
94
+
95
+ model = T5ForConditionalGeneration.from\_pretrained("EnderAir/proximity")
96
+
97
+
98
+
99
+ text = "grammar: He are moving here."
100
+
101
+ inputs = tokenizer(text, return\_tensors="pt")
102
+
103
+ outputs = model.generate(\*\*inputs, max\_length=64, num\_beams=5)
104
+
105
+ print(tokenizer.decode(outputs\[0], skip\_special\_tokens=True))
106
+
107
+ \# "He is moving here."
108
+
109
+ ```
110
+
111
+
112
+
113
+ Note: always prefix input text with `"grammar: "` — this is the T5 task prefix convention used during training.
114
+
115
+
116
+
117
+ \## License
118
+
119
+
120
+
121
+ Apache 2.0
122
+
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": true,
4
+ "eos_token": "</s>",
5
+ "extra_ids": 100,
6
+ "extra_special_tokens": [
7
+ "<extra_id_0>",
8
+ "<extra_id_1>",
9
+ "<extra_id_2>",
10
+ "<extra_id_3>",
11
+ "<extra_id_4>",
12
+ "<extra_id_5>",
13
+ "<extra_id_6>",
14
+ "<extra_id_7>",
15
+ "<extra_id_8>",
16
+ "<extra_id_9>",
17
+ "<extra_id_10>",
18
+ "<extra_id_11>",
19
+ "<extra_id_12>",
20
+ "<extra_id_13>",
21
+ "<extra_id_14>",
22
+ "<extra_id_15>",
23
+ "<extra_id_16>",
24
+ "<extra_id_17>",
25
+ "<extra_id_18>",
26
+ "<extra_id_19>",
27
+ "<extra_id_20>",
28
+ "<extra_id_21>",
29
+ "<extra_id_22>",
30
+ "<extra_id_23>",
31
+ "<extra_id_24>",
32
+ "<extra_id_25>",
33
+ "<extra_id_26>",
34
+ "<extra_id_27>",
35
+ "<extra_id_28>",
36
+ "<extra_id_29>",
37
+ "<extra_id_30>",
38
+ "<extra_id_31>",
39
+ "<extra_id_32>",
40
+ "<extra_id_33>",
41
+ "<extra_id_34>",
42
+ "<extra_id_35>",
43
+ "<extra_id_36>",
44
+ "<extra_id_37>",
45
+ "<extra_id_38>",
46
+ "<extra_id_39>",
47
+ "<extra_id_40>",
48
+ "<extra_id_41>",
49
+ "<extra_id_42>",
50
+ "<extra_id_43>",
51
+ "<extra_id_44>",
52
+ "<extra_id_45>",
53
+ "<extra_id_46>",
54
+ "<extra_id_47>",
55
+ "<extra_id_48>",
56
+ "<extra_id_49>",
57
+ "<extra_id_50>",
58
+ "<extra_id_51>",
59
+ "<extra_id_52>",
60
+ "<extra_id_53>",
61
+ "<extra_id_54>",
62
+ "<extra_id_55>",
63
+ "<extra_id_56>",
64
+ "<extra_id_57>",
65
+ "<extra_id_58>",
66
+ "<extra_id_59>",
67
+ "<extra_id_60>",
68
+ "<extra_id_61>",
69
+ "<extra_id_62>",
70
+ "<extra_id_63>",
71
+ "<extra_id_64>",
72
+ "<extra_id_65>",
73
+ "<extra_id_66>",
74
+ "<extra_id_67>",
75
+ "<extra_id_68>",
76
+ "<extra_id_69>",
77
+ "<extra_id_70>",
78
+ "<extra_id_71>",
79
+ "<extra_id_72>",
80
+ "<extra_id_73>",
81
+ "<extra_id_74>",
82
+ "<extra_id_75>",
83
+ "<extra_id_76>",
84
+ "<extra_id_77>",
85
+ "<extra_id_78>",
86
+ "<extra_id_79>",
87
+ "<extra_id_80>",
88
+ "<extra_id_81>",
89
+ "<extra_id_82>",
90
+ "<extra_id_83>",
91
+ "<extra_id_84>",
92
+ "<extra_id_85>",
93
+ "<extra_id_86>",
94
+ "<extra_id_87>",
95
+ "<extra_id_88>",
96
+ "<extra_id_89>",
97
+ "<extra_id_90>",
98
+ "<extra_id_91>",
99
+ "<extra_id_92>",
100
+ "<extra_id_93>",
101
+ "<extra_id_94>",
102
+ "<extra_id_95>",
103
+ "<extra_id_96>",
104
+ "<extra_id_97>",
105
+ "<extra_id_98>",
106
+ "<extra_id_99>"
107
+ ],
108
+ "is_local": false,
109
+ "local_files_only": false,
110
+ "model_max_length": 512,
111
+ "pad_token": "<pad>",
112
+ "tokenizer_class": "T5Tokenizer",
113
+ "unk_token": "<unk>"
114
+ }