lunahr commited on
Commit
f387f21
·
verified ·
1 Parent(s): fd140e3

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - lunahr/normalization-data-mixed
5
+ language:
6
+ - en
7
+ base_model:
8
+ - Qwen/Qwen3-0.6B-Base
9
+ pipeline_tag: text-generation
10
+ library_name: transformers
11
+ tags:
12
+ - text-transformation
13
+ - text-normalization
14
+ ---
15
+
16
+ # Model Card for CeluneNorm-0.6B-v2.0-ctx2048
17
+
18
+ ## Model Details
19
+
20
+ ### Model Description
21
+ CeluneNorm is a lightweight text normalization model designed for TTS and general preprocessing pipelines.
22
+
23
+ It converts poorly formatted input into clean, readable text while preserving the original meaning.
24
+
25
+ Example:
26
+
27
+ - Input: `this is a badly formed sentence`
28
+ - Output: `This is a badly formed sentence.`
29
+
30
+ The model is conservative by design:
31
+ - It does not rewrite sentences
32
+ - It avoids changing meaning
33
+ - It preserves domain-specific tokens (e.g. URLs, commands, names)
34
+
35
+ ### Update
36
+ Version 2.0 improves performance on longer contexts compared to version 1.3.
37
+
38
+ It is recommended to use version 2.0 if you require to normalize inputs of more than 128 tokens, up to 2048 tokens.
39
+
40
+ The model should retain the base capabilities of version 1.3 across longer context windows.
41
+
42
+ ### Usage
43
+
44
+ The model expects input in the following format:
45
+ ```
46
+ YOUR INPUT<NORM>
47
+ ```
48
+
49
+ It will generate the normalized version of the input.
50
+
51
+ Inference example:
52
+ ```py
53
+ from transformers import pipeline, AutoTokenizer
54
+
55
+ model_id = "lunahr/CeluneNorm-0.6B-v2.0-ctx2048"
56
+
57
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
58
+ pipe = pipeline(
59
+ "text-generation",
60
+ model=model_id,
61
+ tokenizer=model_id,
62
+ device="cuda:0", # "cpu" for CPU-only, slower
63
+ )
64
+
65
+ def normalize(text: str) -> str:
66
+ history = [
67
+ {"role": "user", "content": text}
68
+ ]
69
+ prompt = tokenizer.apply_chat_template(history, tokenize=False)
70
+
71
+ out = pipe(
72
+ prompt,
73
+ max_new_tokens=2048,
74
+ do_sample=False,
75
+ return_full_text=False,
76
+ )
77
+
78
+ return out[0]["generated_text"].strip()
79
+
80
+ # example
81
+ print(normalize("if i type something more complicated into celune it will fix it"))
82
+ ```
83
+
84
+ ### Key Characteristics
85
+
86
+ - Deterministic (no sampling required)
87
+ - Preserves structure and intent
88
+ - Handles mixed text (natural language + technical content)
89
+ - Conservative punctuation (prefers `.` over `!` unless explicit)
90
+ - Supports multi-sentence normalization when boundaries are clear
91
+ - Supports long-context normalization of up to 2048 tokens
92
+
93
+ ---
94
+
95
+ - **Developed by:** https://huggingface.co/lunahr
96
+ - **Model type:** Causal Language Model
97
+ - **Language(s):** English
98
+ - **License:** MIT
99
+ - **Base model:** Qwen/Qwen3-0.6B-Base
100
+
101
+ ---
102
+
103
+ ## Limitations
104
+
105
+ This model is not intended to be a full grammar correction system.
106
+
107
+ Possible limitations include:
108
+
109
+ - May miss some punctuation or casing corrections
110
+ - May be conservative with contractions (e.g. `there s` -> unchanged)
111
+ - May preserve ambiguous casing when intent is unclear
112
+ - Does not expand slang or rewrite informal language
113
+ - May miss some characters at extended context lengths
114
+
115
+ The model prioritizes safety and meaning preservation over aggressive correction.
116
+
117
+ ---
118
+
119
+ ## Training Details
120
+
121
+ ### Dataset
122
+
123
+ Trained on: https://huggingface.co/datasets/lunahr/normalization-data-mixed
124
+
125
+ The dataset includes a mix of:
126
+
127
+ - Formal text (Wikipedia-style)
128
+ - Conversational text (PersonaChat)
129
+ - Synthetic edge cases
130
+ - Quoted text handling
131
+
132
+ This combination helps the model generalize across both clean and noisy inputs.
133
+
134
+ This version was also tuned on an additional 10k rows of casing data to improve accuracy.
135
+
136
+ Long context coherence was trained with 5k rows of 2048-context-length data to stop the model from looping on itself.
137
+
138
+ ---
139
+
140
+ ### Training Procedure
141
+
142
+ - Fine-tuned from Qwen3-0.6B-Base
143
+ - Hardware: Kaggle dual NVIDIA T4 (FP16, casted to BF16 for output model)
144
+ - Training time: ~1.5 hours + ~5 minutes (casing CFT) + ~50 minutes (long-context CFT)
145
+ - Epochs: 3 + 1 (casing CFT) + 1 (long context CFT)
146
+
147
+ Training configuration highlights:
148
+
149
+ - Learning rate: 8e-5
150
+ - Gradient clipping: 1.0
151
+ - Warmup: 200 steps (~10%)
152
+
153
+ ---
154
+
155
+ ### Metrics
156
+
157
+ - Final training loss: 0.08841 (0.06989 for casing CFT, 0.07981 for long-context CFT)
158
+ - Mean token accuracy: 97.53% (99.77% for casing CFT, 97.89% for long-context CFT)
159
+
160
+ These metrics reflect token-level accuracy; real-world normalization quality is slightly lower but more representative (~90-95% human-level correctness).
161
+
162
+ ---
added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "<NORM>": 151669,
3
+ "<|endoftext|>": 151643,
4
+ "<|im_end|>": 151645,
5
+ "<|im_start|>": 151644
6
+ }
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% for message in messages %}{% if message['role'] == 'user' %}{% if '<NORM>' in message['content'] %}{{ message['content'] }}{% else %}{{ message['content'] }}<NORM>{% endif %}{% endif %}{% endfor %}
config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151643,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 2048,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": null,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.8.1",
60
+ "use_cache": true,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151647
63
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "eos_token_id": 151643,
4
+ "max_new_tokens": 1024,
5
+ "transformers_version": "5.8.1"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6c292549c2aef1b1c26fa4999666904a910354ae62af2be494d08d2bddce101
3
+ size 1191543224
special_tokens_map.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<NORM>"
6
+ ],
7
+ "eos_token": {
8
+ "content": "<|endoftext|>",
9
+ "lstrip": false,
10
+ "normalized": false,
11
+ "rstrip": false,
12
+ "single_word": false
13
+ },
14
+ "pad_token": {
15
+ "content": "<|endoftext|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ }
21
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b7baed638506fe05577afe018db3b4ff02b4c6a684a112a8582a24596fcff7a
3
+ size 11418445
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<NORM>"
12
+ ],
13
+ "is_local": true,
14
+ "local_files_only": false,
15
+ "model_max_length": 2048,
16
+ "pad_token": "<|endoftext|>",
17
+ "split_special_tokens": false,
18
+ "tokenizer_class": "Qwen2Tokenizer",
19
+ "unk_token": null
20
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff