faz1_01: tr_tc100b kaynagi (TC-100B ~103B TR, data_dir=pretrain) — v1.5b ana TR; 4-tuple data_dir destegi
Browse files
code/kod/faz1_01_tokenize_shard.py
CHANGED
|
@@ -8,6 +8,7 @@ Mixture EĞİTİMDE uygulanır; shard'lar source/lang etiketli tutulur.
|
|
| 8 |
Kaynaklar (--source):
|
| 9 |
en_fineweb_edu : HuggingFaceFW/fineweb-edu (sample-10BT) lang=en
|
| 10 |
tr_fineweb2_hq : epfml/FineWeb2-HQ (tur_Latn) lang=tr
|
|
|
|
| 11 |
|
| 12 |
Kullanım:
|
| 13 |
python kod/faz1_01_tokenize_shard.py --source en_fineweb_edu --target_tokens 5_000_000 --seqs_per_shard 1500
|
|
@@ -24,6 +25,8 @@ from decontam import Decontaminator
|
|
| 24 |
SOURCES = {
|
| 25 |
"en_fineweb_edu": ("HuggingFaceFW/fineweb-edu", "sample-10BT", "en"),
|
| 26 |
"tr_fineweb2_hq": ("epfml/FineWeb2-HQ", "tur_Latn", "tr"),
|
|
|
|
|
|
|
| 27 |
# NOT: StarCoder2/the-stack gate'li, datasets 4.x script kaynaklarını desteklemiyor.
|
| 28 |
# codeparrot-clean (ham Python, content kolonu) gate'siz ikamesi.
|
| 29 |
"code_codeparrot": ("codeparrot/codeparrot-clean", None, "code"),
|
|
@@ -56,7 +59,9 @@ def main():
|
|
| 56 |
help="13-gram index; yoksa filtre atlanır")
|
| 57 |
args = ap.parse_args()
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
outdir = os.path.join(args.out_dir, args.source)
|
| 61 |
os.makedirs(outdir, exist_ok=True)
|
| 62 |
tok = SCTokenizer()
|
|
@@ -66,13 +71,13 @@ def main():
|
|
| 66 |
print(f"[decontam] {len(dec.grams):,} adet 13-gram yüklendi → kontamine doc'lar atlanacak")
|
| 67 |
else:
|
| 68 |
print("[decontam] index yok → filtre KAPALI (uyarı: eval sızıntısı kontrol edilmiyor)")
|
| 69 |
-
print(f"[{args.source}] repo={repo} cfg={cfg} lang={lang} | seq_len={args.seq_len} "
|
| 70 |
f"| hedef ~{args.target_tokens/1e6:.1f}M token | vocab={tok.vocab_size}")
|
| 71 |
|
| 72 |
-
ds = load_dataset(repo, name=cfg, split="train", streaming=True)
|
| 73 |
buf, seqs, shard_idx = [], [], 0
|
| 74 |
tot_tokens = tot_seqs = ndocs = n_skip = 0
|
| 75 |
-
manifest = {"source": args.source, "repo": repo, "config": cfg, "lang": lang,
|
| 76 |
"seq_len": args.seq_len, "shards": []}
|
| 77 |
t0 = time.perf_counter()
|
| 78 |
|
|
|
|
| 8 |
Kaynaklar (--source):
|
| 9 |
en_fineweb_edu : HuggingFaceFW/fineweb-edu (sample-10BT) lang=en
|
| 10 |
tr_fineweb2_hq : epfml/FineWeb2-HQ (tur_Latn) lang=tr
|
| 11 |
+
tr_tc100b : lumees/turkish-corpus-100b (data_dir=pretrain, ~103B, Apache) lang=tr [v1.5b ANA TR]
|
| 12 |
|
| 13 |
Kullanım:
|
| 14 |
python kod/faz1_01_tokenize_shard.py --source en_fineweb_edu --target_tokens 5_000_000 --seqs_per_shard 1500
|
|
|
|
| 25 |
SOURCES = {
|
| 26 |
"en_fineweb_edu": ("HuggingFaceFW/fineweb-edu", "sample-10BT", "en"),
|
| 27 |
"tr_fineweb2_hq": ("epfml/FineWeb2-HQ", "tur_Latn", "tr"),
|
| 28 |
+
# v1.5b ANA TR: TC-100B (~103B, Apache, FineWeb-2-TR+Cosmos-sentetik+TR-Wiki+haber+math). 4. eleman = data_dir.
|
| 29 |
+
"tr_tc100b": ("lumees/turkish-corpus-100b", None, "tr", "pretrain"),
|
| 30 |
# NOT: StarCoder2/the-stack gate'li, datasets 4.x script kaynaklarını desteklemiyor.
|
| 31 |
# codeparrot-clean (ham Python, content kolonu) gate'siz ikamesi.
|
| 32 |
"code_codeparrot": ("codeparrot/codeparrot-clean", None, "code"),
|
|
|
|
| 59 |
help="13-gram index; yoksa filtre atlanır")
|
| 60 |
args = ap.parse_args()
|
| 61 |
|
| 62 |
+
src = SOURCES[args.source]
|
| 63 |
+
repo, cfg, lang = src[0], src[1], src[2]
|
| 64 |
+
data_dir = src[3] if len(src) > 3 else None # dizin-yapılı dataset (TC-100B: pretrain/)
|
| 65 |
outdir = os.path.join(args.out_dir, args.source)
|
| 66 |
os.makedirs(outdir, exist_ok=True)
|
| 67 |
tok = SCTokenizer()
|
|
|
|
| 71 |
print(f"[decontam] {len(dec.grams):,} adet 13-gram yüklendi → kontamine doc'lar atlanacak")
|
| 72 |
else:
|
| 73 |
print("[decontam] index yok → filtre KAPALI (uyarı: eval sızıntısı kontrol edilmiyor)")
|
| 74 |
+
print(f"[{args.source}] repo={repo} cfg={cfg} dir={data_dir} lang={lang} | seq_len={args.seq_len} "
|
| 75 |
f"| hedef ~{args.target_tokens/1e6:.1f}M token | vocab={tok.vocab_size}")
|
| 76 |
|
| 77 |
+
ds = load_dataset(repo, name=cfg, data_dir=data_dir, split="train", streaming=True)
|
| 78 |
buf, seqs, shard_idx = [], [], 0
|
| 79 |
tot_tokens = tot_seqs = ndocs = n_skip = 0
|
| 80 |
+
manifest = {"source": args.source, "repo": repo, "config": cfg, "data_dir": data_dir, "lang": lang,
|
| 81 |
"seq_len": args.seq_len, "shards": []}
|
| 82 |
t0 = time.perf_counter()
|
| 83 |
|