Commit
·
252a85f
1
Parent(s):
efe3e02
Pre-v4 readme and support files update
Browse files- README.md +27 -8
- src/data/generate_clean_corpus.sh +1 -0
- src/data/generate_cyr_lat_pairs.py +29 -1
README.md
CHANGED
|
@@ -82,7 +82,7 @@ This project:
|
|
| 82 |
|
| 83 |
---
|
| 84 |
|
| 85 |
-
## 💻 Try it out
|
| 86 |
|
| 87 |
Құшақтап тұрған бет арқылы тікелей пайдаланыңыз 🤗 Трансформерлер / Use directly via Hugging Face 🤗 Transformers:
|
| 88 |
|
|
@@ -100,26 +100,45 @@ print(output)
|
|
| 100 |
|
| 101 |
---
|
| 102 |
|
| 103 |
-
##
|
| 104 |
|
| 105 |
-
DalaT5
|
| 106 |
|
| 107 |
-
- The first ~1.5 million records of the Kazakh subset of the CC100 dataset by [Conneau et al.](https://paperswithcode.com/paper/unsupervised-cross-lingual-representation-1)
|
| 108 |
-
- The
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
Деректер жиынының жалпы өлшемін ескере отырып, олар осы үлгінің репозиторийіне қосылмаған. Дегенмен, DalaT5-ті өзіңіз дәл баптағыңыз келсе, келесі әрекеттерді орындаңыз / Given the total size of the datasets, they haven't been included in this model's repository. However, should you wish to fine-tune DalaT5 yourself, please do the following:
|
| 111 |
|
| 112 |
1. `get_data.sh` қабық сценарий файлын «src/data» қалтасында іске қосыңыз / Run the `get_data.sh` shell script file in the "src/data" folder
|
| 113 |
2. Сол қалтадағы `generate_cyr_lat_pairs.py` файлын іске қосыңыз / Run the `generate_cyr_lat_pairs.py` file in the same folder
|
| 114 |
-
3. Қазақ корпус файлын тазалау үшін `generate_clean_corpus.sh` іске қосыңыз / Run `generate_clean_corpus.sh` to clean the Kazakh corpus file
|
|
|
|
|
|
|
| 115 |
|
| 116 |
Егер сіз Windows жүйесінде болсаңыз, `get_data.sh` сценарийі жұмыс істемеуі мүмкін. Дегенмен, файлдағы сілтемелерді орындап, ондағы қадамдарды қолмен орындау арқылы әлі де деректерді алуға болады. Сол сияқты, `generate_clean_corpus.sh` файлында да қате пайда болады, бұл сізге `kazakh_latin_corpus.json` файлындағы бос немесе бос жолдарды сүзу үшін баламалы Windows функциясын табуды талап етеді. Оған қоса, `wikiextractor` бумасын алдын ала орнатқаныңызға сенімді болыңыз (нақты пайдаланылған нұсқаны `requirements.txt` файлынан табуға болады) / If you're on Windows, the `get_data.sh` script likely won't work. However, you can still get the data by following the links in the file and manually doing the steps in there. Likewise, `generate_clean_corpus.sh` will also error out, requiring you to find an equivalent Windows functionality to filter out blank or empty lines in the `kazakh_latin_corpus.json` file. Additionally, be sure to install the `wikiextractor` package beforehand (the exact version used can be found in the `requirements.txt` file).
|
| 117 |
|
| 118 |
---
|
| 119 |
|
| 120 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
-
Егер сіз DalaT5-ті туынды жұмыстарды зерттеуде
|
| 123 |
|
| 124 |
```
|
| 125 |
@misc{crossroderick_dalat5_2025,
|
|
|
|
| 82 |
|
| 83 |
---
|
| 84 |
|
| 85 |
+
## 💻 Байқап көріңіз / Try it out
|
| 86 |
|
| 87 |
Құшақтап тұрған бет арқылы тікелей пайдаланыңыз 🤗 Трансформерлер / Use directly via Hugging Face 🤗 Transformers:
|
| 88 |
|
|
|
|
| 100 |
|
| 101 |
---
|
| 102 |
|
| 103 |
+
## 🙏 Алғыс / Acknowledgements
|
| 104 |
|
| 105 |
+
Тәуелсіз жоба болғанына қарамастан, DalaT5 өте маңызды үш деректер жиынтығын пайдаланады / Despite being an independent project, DalaT5 makes use of three very important datasets:
|
| 106 |
|
| 107 |
+
- The first ~1.5 million records of the Kazakh subset of the CC100 dataset by [Conneau et al. (2020)](https://paperswithcode.com/paper/unsupervised-cross-lingual-representation-1)
|
| 108 |
+
- The raw, Kazakh-focused part of the [Kazakh Parallel Corpus (KazParC)](https://huggingface.co/datasets/issai/kazparc) from Nazarbayev University's Institute of Smart Systems and Artificial Intelligence (ISSAI), graciously made available on Hugging Face
|
| 109 |
+
- The Wikipedia dump of articles in the Kazakh language, obtained via the `wikiextractor` Python package
|
| 110 |
+
|
| 111 |
+
---
|
| 112 |
+
|
| 113 |
+
## 📊 Нақты баптау нұсқаулары / Fine-tuning instructions
|
| 114 |
|
| 115 |
Деректер жиынының жалпы өлшемін ескере отырып, олар осы үлгінің репозиторийіне қосылмаған. Дегенмен, DalaT5-ті өзіңіз дәл баптағыңыз келсе, келесі әрекеттерді орындаңыз / Given the total size of the datasets, they haven't been included in this model's repository. However, should you wish to fine-tune DalaT5 yourself, please do the following:
|
| 116 |
|
| 117 |
1. `get_data.sh` қабық сценарий файлын «src/data» қалтасында іске қосыңыз / Run the `get_data.sh` shell script file in the "src/data" folder
|
| 118 |
2. Сол қалтадағы `generate_cyr_lat_pairs.py` файлын іске қосыңыз / Run the `generate_cyr_lat_pairs.py` file in the same folder
|
| 119 |
+
3. Қазақ корпус файлын тазалау және деректер жинағын араластыру үшін `generate_clean_corpus.sh` іске қосыңыз / Run `generate_clean_corpus.sh` to clean the Kazakh corpus file and shuffle the dataset
|
| 120 |
+
|
| 121 |
+
KazParC деректер жинағын жүктеп алу үшін сізге Hugging Face есептік жазбасы қажет екенін ескеріңіз. Бұған қоса, жүктеп алуды бастау үшін өзіңізді аутентификациялау үшін «huggingface-cli» орнатуыңыз қажет. Бұл туралы толығырақ [мына жерден](https://huggingface.co/docs/huggingface_hub/en/guides/cli) оқыңыз. / Please note that you'll need a Hugging Face account to download the KazParC dataset. Additionally, you'll need to install `huggingface-cli` to authenticate yourself for the download to commence. Read more about it [here](https://huggingface.co/docs/huggingface_hub/en/guides/cli).
|
| 122 |
|
| 123 |
Егер сіз Windows жүйесінде болсаңыз, `get_data.sh` сценарийі жұмыс істемеуі мүмкін. Дегенмен, файлдағы сілтемелерді орындап, ондағы қадамдарды қолмен орындау арқылы әлі де деректерді алуға болады. Сол сияқты, `generate_clean_corpus.sh` файлында да қате пайда болады, бұл сізге `kazakh_latin_corpus.json` файлындағы бос немесе бос жолдарды сүзу үшін баламалы Windows функциясын табуды талап етеді. Оған қоса, `wikiextractor` бумасын алдын ала орнатқаныңызға сенімді болыңыз (нақты пайдаланылған нұсқаны `requirements.txt` файлынан табуға болады) / If you're on Windows, the `get_data.sh` script likely won't work. However, you can still get the data by following the links in the file and manually doing the steps in there. Likewise, `generate_clean_corpus.sh` will also error out, requiring you to find an equivalent Windows functionality to filter out blank or empty lines in the `kazakh_latin_corpus.json` file. Additionally, be sure to install the `wikiextractor` package beforehand (the exact version used can be found in the `requirements.txt` file).
|
| 124 |
|
| 125 |
---
|
| 126 |
|
| 127 |
+
## 📋 Өзгеріс журналы / Changelog
|
| 128 |
+
|
| 129 |
+
- **DalaT5 v1:** 13 сәуірде дәл реттелген, 13 сәуірде қолжетімді болды. Жаттығу үшін ~38 мың деректер жазбасы пайдаланылды. Дисперсиясы жоғары және үлгі сенімділігі төмен бастапқы нұсқа / Fine-tuned on April 13, made available on April 13. Used ~38k data records for training. Initial version with high variance and low model confidence
|
| 130 |
+
|
| 131 |
+
- **DalaT5 v2:** 18 сәуірде дәл реттелген, 18 сәуірде қолжетімді болды. Жаттығу үшін ~1 миллион деректер жазбасы пайдаланылды. Деректердің көп болуының арқасында әлдеқайда жақсы өнімділікті көрсеткен екінші итерация / Fine-tuned on April 18, made available on April 18. Used ~1 million data records for training. Second iteration that exhibited much better performance owing to more data availability
|
| 132 |
+
|
| 133 |
+
- **DalaT5 v3**: 20 сәуірде дәл реттелген, 20 сәуірде қолжетімді болды. Жаттығу үшін ~1,6 миллион деректер жазбасы пайдаланылды. Үшінші итерация одан әрі жақсартуларды, сондай-ақ белгілі бір дәрежеде семантикалық түсінуді көрсетті / Fine-tuned on April 20, made available on April 20. Used ~1.6 million data records for training. Third iteration that showed further improvements, as well as some degree of semantic understanding
|
| 134 |
+
|
| 135 |
+
- **DalaT5 v4**: Нақты баптау 23 сәуірде басталады және сол күні қолжетімді болады. ~1,8 миллион жазбаны пайдалануға орнату (Wikipedia dump + CC100 + KazParC) / Fine-tuning to commence on April 23 and will be made available on the same day. Set to use ~1.8 million records (Wikipedia dump + CC100 + KazParC)
|
| 136 |
+
|
| 137 |
+
---
|
| 138 |
+
|
| 139 |
+
## 📚 Несиелер / Credits
|
| 140 |
|
| 141 |
+
Егер сіз DalaT5-ті туынды жұмыстарды зерттеуде қолдансаңыз - біріншіден, рахмет. Екіншіден, егер сіз қаласаңыз, дәйексөз келтіріңіз / If you use DalaT5 in research of derivative works - first off, thank you. Secondly, should you be willing, feel free to cite:
|
| 142 |
|
| 143 |
```
|
| 144 |
@misc{crossroderick_dalat5_2025,
|
src/data/generate_clean_corpus.sh
CHANGED
|
@@ -1 +1,2 @@
|
|
|
|
|
| 1 |
grep '\S' kazakh_latin_corpus.jsonl > clean_corpus.jsonl
|
|
|
|
| 1 |
+
shuf kazakh_latin_corpus.jsonl -o kazakh_latin_corpus.jsonl
|
| 2 |
grep '\S' kazakh_latin_corpus.jsonl > clean_corpus.jsonl
|
src/data/generate_cyr_lat_pairs.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import json
|
| 3 |
from tqdm import tqdm
|
| 4 |
from itertools import islice
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
# Kazakh Cyrillic character to the Kazakh Latin character mapping from 2021 onwards
|
|
@@ -127,4 +128,31 @@ with open(output_path, 'w', encoding = "utf-8") as out_file:
|
|
| 127 |
except Exception as e:
|
| 128 |
tqdm.write(f"Skipping due to: {e}")
|
| 129 |
|
| 130 |
-
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
from tqdm import tqdm
|
| 4 |
from itertools import islice
|
| 5 |
+
from datasets import load_dataset
|
| 6 |
|
| 7 |
|
| 8 |
# Kazakh Cyrillic character to the Kazakh Latin character mapping from 2021 onwards
|
|
|
|
| 128 |
except Exception as e:
|
| 129 |
tqdm.write(f"Skipping due to: {e}")
|
| 130 |
|
| 131 |
+
continue
|
| 132 |
+
|
| 133 |
+
# Third step: process the raw, Kazakh-centred part of the "KazParC" dataset
|
| 134 |
+
print("Loading 'KazParC' dataset...")
|
| 135 |
+
|
| 136 |
+
kazparc = load_dataset("issai/kazparc", "kazparc_raw", split = "train")
|
| 137 |
+
|
| 138 |
+
with open(output_path, 'a', encoding = "utf-8") as out_file:
|
| 139 |
+
for entry in tqdm(kazparc, desc = "Entries in KazParC"):
|
| 140 |
+
try:
|
| 141 |
+
if "kk" in entry and isinstance(entry["kk"], str):
|
| 142 |
+
cyr_text = entry["kk"].strip()
|
| 143 |
+
lat_text = convert_to_latin(cyr_text).strip()
|
| 144 |
+
|
| 145 |
+
if cyr_text and lat_text:
|
| 146 |
+
obj = {
|
| 147 |
+
"transliteration": {
|
| 148 |
+
"src": cyr_text,
|
| 149 |
+
"tgt": lat_text
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
out_file.write(json.dumps(obj, ensure_ascii = False) + "\n")
|
| 154 |
+
|
| 155 |
+
except Exception as e:
|
| 156 |
+
tqdm.write(f"Skipping due to: {e}")
|
| 157 |
+
|
| 158 |
+
continue
|