Ahmetemiiii2 commited on
Commit
0192e3a
·
verified ·
1 Parent(s): 45773b8

Töz-Çevir-1 v1.0.0: 120k adım, 74.1M parametre

Browse files
Files changed (6) hide show
  1. LICENSE +202 -0
  2. README.md +150 -0
  3. config.json +23 -0
  4. model.safetensors +3 -0
  5. tokenizer.model +3 -0
  6. toz-cevir.pt +3 -0
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - tr
6
+ library_name: pytorch
7
+ pipeline_tag: translation
8
+ tags:
9
+ - translation
10
+ - machine-translation
11
+ - english
12
+ - turkish
13
+ - encoder-decoder
14
+ - seq2seq
15
+ - from-scratch
16
+ - sentencepiece
17
+ - trained-from-scratch
18
+ - small-language-model
19
+ - turkish-translation
20
+ - türkçe
21
+ - turkish-nlp
22
+ - english-turkish
23
+ - en-tr
24
+ - tr-en
25
+ metrics:
26
+ - chrf
27
+ - bleu
28
+ ---
29
+
30
+ # Töz-Çevir-1
31
+
32
+ **Töz-Çevir-1** is [Töz AI](https://huggingface.co/TozAI)'s English ↔ Turkish translation model, trained from scratch. 74.1M parameters, one model for both directions, Apache-2.0. It is the sibling of [Töz-1](https://huggingface.co/TozAI/Toz-1).
33
+
34
+ It was trained by one person on Kaggle's free 2×T4 GPUs, without any non-commercial data and without distilling from another translation model. On the benchmarks below it is ahead of the similarly sized OPUS-MT base model everywhere, and on English→Turkish it is level with OPUS-MT tc-big, which has about three times as many parameters. Turkish→English is where it still falls short.
35
+
36
+ ## Results
37
+
38
+ chrF++ / BLEU on 500 sentences from each test set, beam size 4. Higher is better; best chrF++ per row in bold.
39
+
40
+ | Test set | Direction | **Töz-Çevir-1** (74M) | OPUS-MT base (~75M) | OPUS-MT tc-big (~235M) |
41
+ |---|---|---|---|---|
42
+ | FLORES-200 devtest | en→tr | **60.0** / 32.6 | 55.5 / 26.0 | 59.2 / 30.9 |
43
+ | FLORES-200 devtest | tr→en | 59.1 / 35.5 | 56.7 / 31.7 | **62.1** / 38.0 |
44
+ | WMT24++ | en→tr | **53.1** / 24.5 | 46.8 / 18.4 | 50.8 / 22.4 |
45
+ | NTREX-128 | en→tr | 48.3 / 18.7 | 46.7 / 16.5 | **48.8** / 19.0 |
46
+
47
+ How to read this:
48
+
49
+ - The 500 sentences are a fixed subset (every ⌊N/500⌋-th sentence, first 500 taken), the same for every system. The full sets have 1012 (FLORES), 960 (WMT24++) and 1997 (NTREX) sentences, so differences of a few tenths of a point are within noise.
50
+ - Scores come from `egitim/olcum.py` with sacrebleu (chrF++ = chrF with word order 2, BLEU with default tokenization). All systems were run by us with the same settings.
51
+ - "OPUS-MT base" is `Helsinki-NLP/opus-tatoeba-en-tr` for en→tr (the older `opus-mt-en-tr` is no longer downloadable) and `Helsinki-NLP/opus-mt-tr-en` for tr→en. "tc-big" is `opus-mt-tc-big-en-tr` / `opus-mt-tc-big-tr-en`. Their parameter counts are estimates from checkpoint size.
52
+ - WMT24++ and NTREX were written in English, so only en→tr is reported for them.
53
+ - The checkpoint is the one from step 120,000. Between step 118,675 and 120,000 the scores moved by 0.0–0.4 chrF++.
54
+
55
+ ## Versions
56
+
57
+ | version | date | notes |
58
+ |---|---|---|
59
+ | **v1.0.0** | October 2026 | first release: 120k training steps, scores above |
60
+
61
+ Older versions stay downloadable with `tozcevir.load(revision="v1.0.0")` (a Hub tag).
62
+
63
+ ## Quick start
64
+
65
+ ```bash
66
+ pip install git+https://github.com/Toz-AI/toz-cevir.git
67
+ ```
68
+
69
+ ```python
70
+ import tozcevir
71
+
72
+ t = tozcevir.load() # downloads toz-cevir.pt (~300 MB) and tokenizer.model from the Hub
73
+ print(t.translate("The weather is lovely today.", to="tr"))
74
+ print(t.translate("Bugün hava çok güzel.", to="en"))
75
+ ```
76
+
77
+ You never tell the model the source language, only the target (`to="tr"` or `to="en"`). Longer text is split into sentences and translated one by one, because the model was trained on sentence pairs.
78
+
79
+ Command line:
80
+
81
+ ```bash
82
+ python -m tozcevir --to tr "I love you."
83
+ python -m tozcevir --to en # interactive; :tr / :en switch direction, :q quits
84
+ ```
85
+
86
+ It uses the GPU if there is one and runs on CPU otherwise. Beam search is not batched, so on an RTX 3060 Ti it takes roughly 0.2 s per sentence. Local files work too: `tozcevir.load("path/to/folder")` where the folder has `toz-cevir.pt` and `tokenizer.model`.
87
+
88
+ ## Model
89
+
90
+ Encoder-decoder transformer, 74.1M parameters.
91
+
92
+ | | |
93
+ |---|---|
94
+ | Layers | 10 encoder, 6 decoder |
95
+ | Width | d = 512, 8 heads, SwiGLU feed-forward (1408) |
96
+ | Normalization | RMSNorm, QK-norm |
97
+ | Positions | RoPE in self-attention only |
98
+ | Embeddings | one 32k matrix shared by encoder, decoder and output |
99
+ | Tokenizer | SentencePiece unigram, 32k, byte fallback, digits split |
100
+ | Direction | a `<2tr>` / `<2en>` tag as the first source token |
101
+ | Max input | 254 tokens per sentence |
102
+
103
+ ## Training
104
+
105
+ - **Data:** about 170M raw English–Turkish pairs from [OPUS](https://opus.nlpl.eu/) and HPLT, reduced to 95M after filtering. Filters: length and ratio rules, script and language ID, number consistency, LaBSE similarity, and the LASER scores that come with NLLB. Test sentences were removed by exact match on either side (normalized); there is no n-gram overlap check yet.
106
+ - **Sources:** NLLB (the CCMatrix mining), HPLT v3, OpenSubtitles, MaCoCu, GoURMET, wikimedia, WikiMatrix, SETIMES, Tatoeba, Wikipedia, KDE4, translatewiki, infopankki, Bianet, GlobalVoices, tldr-pages, XLEnt, LinguaTools-WikiTitles. Web-mined text and subtitles make up most of the tokens; clean human translations are a small share and were sampled more often.
107
+ - **Left out on purpose:** TED/QED/Tanzil (non-commercial licenses) and WMT news (it is the test data). No synthetic data and no output of another translation model was added, so nothing is distilled. The mined web corpora themselves can still contain some machine-translated pairs.
108
+ - **Run:** 120k steps of about 49k tokens (roughly 6B tokens, each pair seen in a random direction), AdamW, peak learning rate 7e-4 with warmup and a linear decay over the last 15%, label smoothing 0.1, fp16 on 2×T4. About 40 hours of wall-clock time, spread over several Kaggle sessions.
109
+
110
+ The data pipeline, the training script and the reasoning behind the choices are in this repo (`kaggle/`, `egitim/`, `PLAN.md`; the notes are in Turkish).
111
+
112
+ ## Limitations
113
+
114
+ - Sentence-level model. It has no document context, so pronouns, formality and terminology can drift across sentences.
115
+ - Idioms and wordplay are often translated literally.
116
+ - The training text leans towards web pages and subtitles. Formal, legal, medical or very technical text has not been tested and should be checked by a person.
117
+ - Web-mined data can contain wrong or machine-translated pairs, and the model can repeat their mistakes and biases. Names and numbers can be wrong, so check the ones that matter.
118
+ - Turkish→English is about 3 chrF++ behind tc-big.
119
+ - Inputs over 254 tokens are truncated.
120
+
121
+ ## Reproducing the numbers
122
+
123
+ ```bash
124
+ git clone https://github.com/Toz-AI/toz-cevir.git && cd toz-cevir
125
+ pip install -e ".[eval]"
126
+ python egitim/olcum.py --dosya toz-cevir.pt --tokenizer tokenizer.model
127
+ ```
128
+
129
+ The script downloads FLORES-200, WMT24++ and NTREX-128 itself, caches the outputs, and compares against the OPUS-MT models. `--sayi 0` uses the full test sets, `--rakipler yok` skips the other systems.
130
+
131
+ ## License and credits
132
+
133
+ Code and weights are released under Apache-2.0 (see `LICENSE`). The training data comes from many sources with their own licenses (several are CC-BY or CC-BY-SA; OpenSubtitles has no explicit license). Please look at the OPUS and HPLT pages for the details before relying on the data itself. We thank the maintainers of OPUS, HPLT, MaCoCu, GoURMET, Tatoeba and Wikimedia, and the authors of FLORES-200, NTREX and WMT24++ for the test data.
134
+
135
+ ---
136
+
137
+ ## Türkçe
138
+
139
+ **Töz-Çevir-1**, sıfırdan eğitilmiş küçük bir İngilizce ↔ Türkçe çeviri modeli: 74M parametre, iki yön için tek model, Apache-2.0. Kaggle'ın ücretsiz 2×T4 GPU'larında, ticari olmayan (NC) veri kullanmadan ve başka bir çeviri modelinden damıtma yapmadan eğitildi.
140
+
141
+ FLORES-200 en→tr'de chrF++ 60,0 ile yaklaşık üç kat büyük OPUS-MT tc-big'in (59,2) önünde. WMT24++'ta da önde (53,1 / 50,8). NTREX'te biraz geride (48,3 / 48,8). tr→en'de tc-big'in yaklaşık 3 puan altında (59,1 / 62,1). Benzer boydaki OPUS-MT base'i her sette geçiyor. Sayılar her setten 500 cümleyle ölçüldü; tam setlerde küçük farklar oynayabilir.
142
+
143
+ Kullanım:
144
+
145
+ ```bash
146
+ pip install git+https://github.com/Toz-AI/toz-cevir.git
147
+ python -m tozcevir --to tr "Bu bir deneme cümlesidir." # kaynak dili söylemene gerek yok, yalnız hedef
148
+ ```
149
+
150
+ Bilinen eksikler: cümle düzeyinde çalışır (belge bağlamı yok), deyimleri çoğu zaman kelimesi kelimesine çevirir, eğitim metni ağırlıkla web ve altyazı olduğundan resmî, hukuki, tıbbi metinlerde mutlaka kontrol edilmeli. Eğitim hattı, betikler ve kararların gerekçesi `PLAN.md` ve `egitim/README.md` içinde (Türkçe).
config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "toz-cevir",
3
+ "architecture": "encoder-decoder",
4
+ "step": 120000,
5
+ "vocab": 32000,
6
+ "d": 512,
7
+ "enc": 10,
8
+ "dec": 6,
9
+ "head": 8,
10
+ "kv_head": 8,
11
+ "ffn": 1408,
12
+ "dropout": 0.1,
13
+ "max_pos": 1024,
14
+ "rope_taban": 10000.0,
15
+ "special_tokens": {
16
+ "pad": 0,
17
+ "unk": 1,
18
+ "bos": 2,
19
+ "eos": 3,
20
+ "to_en": "<2en>",
21
+ "to_tr": "<2tr>"
22
+ }
23
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e139665a9a8d4173b90c40bd69281825b71f7a18c377362ad7228e548d29f95b
3
+ size 296334320
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c41bf316152821dbb7e547cd7da306433149005f5e49e235b36eb623a3e8cb1
3
+ size 830090
toz-cevir.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dee1749ef6c9b4a2a23e2ac82ed54b5723141cfc5001fc1a7aa17047bd2710e4
3
+ size 296377402