BeardedMonster commited on
Commit
a71350c
·
verified ·
1 Parent(s): 17c0942

Train/test split, output column, new English prompts, Colab notebook

Browse files
README.md CHANGED
@@ -1,26 +1,52 @@
1
  ---
2
  size_categories: [10K<n<100K]
3
- tags: [african-languages, code-switching, idioms, synthetic]
4
  license: other
5
  language: [afr, amh, bam, ewe, fon, ful, gpe, hau, ibo, kik, kin, kon, lin, lug, luo, mlg, nde, nso, nya, orm, pcm, run, sna, som, sot, ssw, swh, tir, tsn, tso, tum, twi, wes, wol, xho, yor, zul, en]
6
  task_categories: [text-generation]
7
  configs:
8
- - {config_name: default, data_files: data/out_scored.jsonl.gz}
 
 
 
 
 
9
  ---
10
 
11
- # csw-1b-synth20k
12
 
13
- About 320,000 code-switched and idiom-rich rewrites in 37 African languages, written by our 1B code-switching model (`AletheiaAING/gemma-3-1b-csw-best`) for 20,019 English texts, each with a quality score. For every English text the model wrote a code-switched version (`hm`) and an idiom-rich rewrite (`ood`), eight candidates each: the greedy output plus seven sampled at temperature 0.8. Nobody has checked the outputs with native speakers.
14
 
15
- In simple words: `hm` mixes two languages the way people talk (Yoruba with English words in the middle of a sentence, say). `ood` rewrites the text in lively, everyday language full of sayings and comparisons.
16
 
17
- | | |
18
- |---|---|
19
- | Rows | 39,941 prompts (19,923 `hm`, 20,018 `ood`) over 20,019 English texts |
20
- | Candidates | 8 per row, 319,528 in total |
21
- | Languages | 37 base languages, about 1,000 to 1,080 rows each. Every text gets one base language, shared by its `hm` and `ood` rows. The `hm` switch language is one of the pairs listed below. |
22
- | Scores | `ev`, a learned quality score from 1 to 10, on every candidate with a valid format (317,900 of 319,528) |
23
- | File | `data/out_scored.jsonl.gz` (63 MB, one JSON object per line) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  ## Fields
26
 
@@ -31,117 +57,200 @@ Each line is one (English text, task) pair.
31
  | `id` | id of the English text; the `hm` and `ood` rows of one text share it |
32
  | `task` | `hm` (code-switching) or `ood` (idiom-rich rewrite) |
33
  | `lang`, `switch` | base language code; switch language code (`hm` only, otherwise `null`) |
 
34
  | `prompt` | the exact prompt given to the model, for example `<hm> <kon>+<fra>: Hey there! ...` |
35
  | `english` | the English source text |
36
  | `source_dataset`, `source_register` | where the English text comes from, and its register (`chat`, `story`, `complex`) |
37
- | `candidates` | the 8 candidates, described below |
 
38
 
39
- Each candidate has `k` (0 is the greedy output, 1 to 7 are samples), `greedy`, `text` (the raw output with tags and device block), `finished` (stopped by itself, not cut off), `devices` (the switched phrases or idioms), `final` (the text without tags and device block), `format_ok` (one device block and a non-empty finished text) and `ev` (the quality score, missing when `format_ok` is false).
40
 
41
  Example row, shortened:
42
 
43
  ```json
44
- {"id": "persona:7cad82bb1996", "task": "hm", "lang": "kon", "switch": "fra",
45
  "prompt": "<hm> <kon>+<fra>: Hey there! Hi there! I love to read books. ...", "english": "Hey there! Hi there! I love to read books. ...",
46
  "source_dataset": "persona", "source_register": "chat",
47
  "candidates": [{"k": 0, "greedy": true, "text": "<kon><fra><dev>les livres | Tes | ...</dev> Eh, mono kele kuna! ...", "finished": true,
48
- "devices": ["les livres", "Tes"], "final": "Eh, mono kele kuna! ...", "format_ok": true, "ev": 3.1}, "... 7 more ..."]}
 
49
  ```
50
 
51
  ## How to use it
52
 
53
  ```python
54
- import gzip, json
55
- from huggingface_hub import hf_hub_download
56
 
57
- path = hf_hub_download("AletheiaAING/csw-1b-synth20k", "data/out_scored.jsonl.gz", repo_type="dataset")
58
- rows = [json.loads(l) for l in gzip.open(path, "rt", encoding="utf-8")]
 
 
59
 
60
- # the highest-scoring valid candidate of every prompt
 
 
61
  best = []
62
- for r in rows:
63
- ok = [c for c in r["candidates"] if c["format_ok"] and "ev" in c]
64
- if ok: best.append((max(ok, key=lambda c: c["ev"]), r))
65
- best.sort(key=lambda x: -x[0]["ev"])
66
- cand, row = best[0]; print(row["lang"], row["task"], round(cand["ev"], 2), cand["final"])
67
  ```
68
 
69
- Or with `datasets`: `load_dataset("AletheiaAING/csw-1b-synth20k", data_files="data/out_scored.jsonl.gz", split="train")`.
70
-
71
- ## About the score
72
-
73
- `ev` comes from a learned model, not from people. A typical candidate scores about 4; the best of the eight for a prompt has a median of 5.6, and 23% of prompts have a best candidate of 7 or more. Please don't rank by `ev` blindly. It likes short, simple code-switching, and the top of the raw ranking is dominated by the Pidgin languages, where English words are normal. Some top candidates are near copies of the English source. A better recipe: keep `format_ok` rows, set a minimum `ev` per language (not one global value), drop near copies of the source, check the language, and have a native speaker look at anything you publish.
74
-
75
- ## English source texts
76
-
77
- The English texts are included as they are in the `english` field and keep the licences of their sources. CC BY 4.0 and ODC-By require attribution to the original datasets.
78
-
79
- | `source_dataset` | Source | Licence | Rows |
80
- |---|---|---|---|
81
- | `soda` | SODA (allenai/soda) | CC BY 4.0 | 12,982 |
82
- | `writingprompts` | WritingPrompts | MIT | 11,868 |
83
- | `persona` | Synthetic-Persona-Chat | CC BY 4.0 | 8,179 |
84
- | `fineweb_edu` | FineWeb-Edu sample | ODC-By | 4,142 |
85
- | `gutenberg` | Project Gutenberg paragraphs | public domain | 2,770 |
86
-
87
- ## Supported languages and switch languages
88
-
89
- Prompts use the formats `<hm> <base>+<switch>: TEXT` and `<ood> <base>: TEXT`.
90
-
91
- | Language | Code used in prompts | Switch languages (trained pairs) | Example prompt (code-switching) |
92
- |---|---|---|---|
93
- | Afrikaans | `afr` | English `eng` | `<hm> <afr>+<eng>: TEXT` |
94
- | Amharic | `amh` | English `eng` | `<hm> <amh>+<eng>: TEXT` |
95
- | Bambara | `bam` | French `fra` | `<hm> <bam>+<fra>: TEXT` |
96
- | Cameroonian Pidgin | `wes` | French `fra` | `<hm> <wes>+<fra>: TEXT` |
97
- | Chichewa | `nya` | English `eng`, Tumbuka `tum` | `<hm> <nya>+<eng>: TEXT` |
98
- | Ewe | `ewe` | French `fra`, English `eng` | `<hm> <ewe>+<fra>: TEXT` |
99
- | Fon | `fon` | French `fra`, Yoruba `yor` | `<hm> <fon>+<fra>: TEXT` |
100
- | Fulah | `ful` | French `fra`, English `eng` | `<hm> <ful>+<fra>: TEXT` |
101
- | Ghanaian Pidgin | `gpe` | Twi `twi`, Ewe `ewe`, Ga `gaa` | `<hm> <gpe>+<twi>: TEXT` |
102
- | Hausa | `hau` | English `eng`, Arabic `ara` | `<hm> <hau>+<eng>: TEXT` |
103
- | Igbo | `ibo` | English `eng`, Nigerian Pidgin `pcm` | `<hm> <ibo>+<eng>: TEXT` |
104
- | Kikuyu | `kik` | English `eng`, Swahili `swh` | `<hm> <kik>+<eng>: TEXT` |
105
- | Kinyarwanda | `kin` | French `fra`, English `eng`, Swahili `swh` | `<hm> <kin>+<fra>: TEXT` |
106
- | Kirundi | `run` | French `fra`, Swahili `swh` | `<hm> <run>+<fra>: TEXT` |
107
- | Kongo | `kon` | French `fra`, Lingala `lin` | `<hm> <kon>+<fra>: TEXT` |
108
- | Lingala | `lin` | French `fra` | `<hm> <lin>+<fra>: TEXT` |
109
- | Luganda | `lug` | English `eng`, Swahili `swh` | `<hm> <lug>+<eng>: TEXT` |
110
- | Luo | `luo` | English `eng`, Swahili `swh` | `<hm> <luo>+<eng>: TEXT` |
111
- | Malagasy | `mlg` | French `fra` | `<hm> <mlg>+<fra>: TEXT` |
112
- | Nigerian Pidgin | `pcm` | Yoruba `yor`, Igbo `ibo`, Hausa `hau` | `<hm> <pcm>+<yor>: TEXT` |
113
- | North Ndebele | `nde` | English `eng`, Shona `sna` | `<hm> <nde>+<eng>: TEXT` |
114
- | Oromo | `orm` | Amharic `amh`, English `eng` | `<hm> <orm>+<amh>: TEXT` |
115
- | Sepedi | `nso` | English `eng` | `<hm> <nso>+<eng>: TEXT` |
116
- | Sesotho | `sot` | English `eng`, Afrikaans `afr` | `<hm> <sot>+<eng>: TEXT` |
117
- | Setswana | `tsn` | English `eng`, Afrikaans `afr` | `<hm> <tsn>+<eng>: TEXT` |
118
- | Shona | `sna` | English `eng` | `<hm> <sna>+<eng>: TEXT` |
119
- | Somali | `som` | Arabic `ara`, English `eng` | `<hm> <som>+<ara>: TEXT` |
120
- | Swahili | `swh` | English `eng`, Arabic `ara`, Sheng `sheng` | `<hm> <swh>+<eng>: TEXT` |
121
- | Swati | `ssw` | English `eng`, Zulu `zul` | `<hm> <ssw>+<eng>: TEXT` |
122
- | Tigrinya | `tir` | Amharic `amh`, English `eng` | `<hm> <tir>+<amh>: TEXT` |
123
- | Tsonga | `tso` | English `eng`, Zulu `zul` | `<hm> <tso>+<eng>: TEXT` |
124
- | Tumbuka | `tum` | English `eng`, Chichewa `nya` | `<hm> <tum>+<eng>: TEXT` |
125
- | Twi | `twi` | English `eng`, Ghanaian Pidgin `gpe` | `<hm> <twi>+<eng>: TEXT` |
126
- | Wolof | `wol` | French `fra` | `<hm> <wol>+<fra>: TEXT` |
127
- | Xhosa | `xho` | English `eng` | `<hm> <xho>+<eng>: TEXT` |
128
- | Yoruba | `yor` | English `eng`, Nigerian Pidgin `pcm` | `<hm> <yor>+<eng>: TEXT` |
129
- | Zulu | `zul` | English `eng` | `<hm> <zul>+<eng>: TEXT` |
130
 
131
- ## What you can use it for
132
 
133
- - Turn single-language chat or instruction data into code-switched user queries or assistant replies.
134
- - Text for ASR language models, TTS scripts and word lists with switched phrases (have a native speaker check it first).
135
- - Test inputs for chatbots, translation, language-ID and NER systems.
136
- - Labelled switched phrases (the `devices` field) for code-switch detection.
137
- - Candidate pairs for studying how to pick good code-switched text.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  ## Limitations
140
 
141
- - The outputs are machine-written and unreviewed. Expect unnatural phrasing, invented idioms, wrong tone marks and meaning drift. Pidgin outputs keep a lot of English.
142
- - The seven sampled candidates are plain temperature samples, and many are worse than the greedy one.
143
- - Scores are not comparable across languages.
 
144
 
145
  ## License
146
 
147
- The English source texts keep the licences listed above. The generated outputs come from a Gemma-based model, so the [Gemma Terms of Use](https://ai.google.dev/gemma/terms) apply to them. Credit "AletheiaAING" if you use the dataset.
 
1
  ---
2
  size_categories: [10K<n<100K]
3
+ tags: [african-languages, code-switching, idioms, benchmark, synthetic]
4
  license: other
5
  language: [afr, amh, bam, ewe, fon, ful, gpe, hau, ibo, kik, kin, kon, lin, lug, luo, mlg, nde, nso, nya, orm, pcm, run, sna, som, sot, ssw, swh, tir, tsn, tso, tum, twi, wes, wol, xho, yor, zul, en]
6
  task_categories: [text-generation]
7
  configs:
8
+ - config_name: default
9
+ data_files:
10
+ - split: train
11
+ path: data/train.jsonl.gz
12
+ - split: test
13
+ path: data/test.jsonl.gz
14
  ---
15
 
16
+ # African Code-Switch Benchmark
17
 
18
+ A dataset for code-switching and idiom-rich writing in 37 African languages. Every row is an English text with a prompt, up to eight candidate rewrites from our 1B code-switching model (`AletheiaAING/gemma-3-1b-csw-best`) and a cleaned `output` column you can use directly. The `test` split is meant to become the benchmark for measuring progress on African-language code-switching, and the `train` split is for building better models. Nobody has checked the candidates with native speakers yet.
19
 
20
+ Two rewrite tasks:
21
 
22
+ - **`hm`** (human-style mixing) writes the text in a base language with a second language mixed in, the way people really talk. Example: Yoruba with English words in the middle of a sentence.
23
+ - **`ood`** rewrites the text in lively, everyday language full of idiomatic expressions (including sayings and comparisons) just like a native speaker would.
24
+
25
+ ## Train and test
26
+
27
+ | Split | English texts | Rows | `hm` rows | `ood` rows | Candidates |
28
+ |---|---|---|---|---|---|
29
+ | `train` | 8,919 | 17,794 | 8,875 | 8,919 | 142,352 |
30
+ | `test` | 11,100 | 22,147 | 11,048 | 11,099 | 177,176 |
31
+
32
+ **`test` is the benchmark.** It is the bigger part (55% of the texts) and is built to be fair to every language: **exactly 300 English texts per language** (37 languages, 11,100 texts), so no language counts more than another when you average scores. Within each language the texts keep the same mix of switch-language pairs and text types as the full data (the two sets differ by less than 1% on source mix, and by less than 0.5% on language pairs). All 81 base-switch pairs appear in `test`, with 66 to 166 `hm` rows each. Use the `test` inputs (`prompt`, `english`) to run your own model and compare it with the candidates or with human references, and report scores per language as well as the average.
33
+
34
+ **`train` is for training.** It holds the remaining 8,919 texts. Because the benchmark takes the larger share, the train split is smaller on purpose. More train data is added separately (see below).
35
+
36
+ **How the split was made.** The split is by English text, so the `hm` and `ood` rows of one text always stay together. Near-duplicate texts (for example conversations that share most of their sentences) are kept on the same side, so the model never sees a near copy of a test text during training. Texts were sampled per language to match the overall mix of switch-language pairs and text types.
37
+
38
+ ### Growing the train set
39
+
40
+ The repository also holds 20,201 new English texts (from SODA, Synthetic-Persona-Chat, Project Gutenberg and FineWeb-Edu) in `data/new_english_prompts.jsonl.gz`, spread evenly over the 37 languages (about 546 texts each) and over the 67 pairs the model was trained on. The notebook `generate_train_extra.ipynb` (download it and upload it in Colab with File > Upload notebook; a T4 GPU is enough) writes code-switched and idiom-rich versions of them with our 8-bit model (`gemma-3-0.8b-csw`) and produces rows in the same format as `train`. None of these texts overlaps with the ones in `test`.
41
+
42
+ ## What you can use it for
43
+
44
+ - Turn single-language chat or instruction data into code-switched user queries or assistant replies.
45
+ - Build text for ASR language models, TTS scripts and word lists with switched phrases (have a native speaker check it first).
46
+ - Test chatbots, translation and language-ID systems on code-switched inputs.
47
+ - Train and evaluate code-switch detectors with the labelled switched phrases (the `devices` field).
48
+ - Measure progress on African-language code-switching with the `test` split.
49
+ - Study how to pick good code-switched text from several candidates.
50
 
51
  ## Fields
52
 
 
57
  | `id` | id of the English text; the `hm` and `ood` rows of one text share it |
58
  | `task` | `hm` (code-switching) or `ood` (idiom-rich rewrite) |
59
  | `lang`, `switch` | base language code; switch language code (`hm` only, otherwise `null`) |
60
+ | `pair_in_training_table` | `false` for the 3,348 `hm` rows whose base-switch pair is outside the 67 pairs our 1B model was trained on (see the pair table); `true` otherwise |
61
  | `prompt` | the exact prompt given to the model, for example `<hm> <kon>+<fra>: Hey there! ...` |
62
  | `english` | the English source text |
63
  | `source_dataset`, `source_register` | where the English text comes from, and its register (`chat`, `story`, `complex`) |
64
+ | `candidates` | the candidates, described below |
65
+ | `output` | the cleaned text of each candidate, in the same order as `candidates`: language tags and the `<dev>...</dev>` block removed, so you can use it directly |
66
 
67
+ Each candidate has `k` (0 is the greedy output, 1 and up are samples), `greedy`, `text` (the raw output with tags and device block), `finished` (stopped by itself, not cut off), `devices` (the switched phrases or idioms), `final` (the text without tags and device block), `format_ok` (one device block and a non-empty finished text) and `ev` (a learned quality score, missing when `format_ok` is false). Use `output[i]` for the text of `candidates[i]`.
68
 
69
  Example row, shortened:
70
 
71
  ```json
72
+ {"id": "persona:7cad82bb1996", "task": "hm", "lang": "kon", "switch": "fra", "pair_in_training_table": true,
73
  "prompt": "<hm> <kon>+<fra>: Hey there! Hi there! I love to read books. ...", "english": "Hey there! Hi there! I love to read books. ...",
74
  "source_dataset": "persona", "source_register": "chat",
75
  "candidates": [{"k": 0, "greedy": true, "text": "<kon><fra><dev>les livres | Tes | ...</dev> Eh, mono kele kuna! ...", "finished": true,
76
+ "devices": ["les livres", "Tes"], "final": "Eh, mono kele kuna! ...", "format_ok": true, "ev": 3.1}, "... 7 more ..."],
77
+ "output": ["Eh, mono kele kuna! ...", "... 7 more ..."]}
78
  ```
79
 
80
  ## How to use it
81
 
82
  ```python
83
+ from datasets import load_dataset
 
84
 
85
+ ds = load_dataset("AletheiaAING/african-code-switch-benchmark") # splits: train, test
86
+ row = ds["test"][0]
87
+ print(row["prompt"]); print(row["output"][0]) # the greedy candidate as clean text
88
+ ```
89
 
90
+ To pick the highest-scoring valid candidate of every prompt:
91
+
92
+ ```python
93
  best = []
94
+ for r in ds["test"]:
95
+ ok = [(c["ev"], o) for c, o in zip(r["candidates"], r["output"]) if c["format_ok"] and "ev" in c]
96
+ if ok: best.append((max(ok)[0], r["lang"], r["task"], max(ok)[1]))
 
 
97
  ```
98
 
99
+ ## Statistics
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
+ Rows are (English text, task) pairs; every text has an `hm` and an `ood` row (a few texts have only one).
102
 
103
+ **Overall.** 20,019 English texts, 39,941 rows, 319,528 candidates, 37 base languages, 81 base-switch pairs. The mean quality score `ev` of a valid candidate is 4.12 (train 4.12, test 4.12); `ev` comes from a learned model, not from people.
104
+
105
+ **English source texts.** The texts keep the licences of their sources (see License). Rows by source:
106
+
107
+ | `source_dataset` | train | test |
108
+ |---|---|---|
109
+ | `soda` | 5744 | 7238 |
110
+ | `writingprompts` | 5296 | 6572 |
111
+ | `persona` | 3682 | 4497 |
112
+ | `fineweb_edu` | 1876 | 2266 |
113
+ | `gutenberg` | 1196 | 1574 |
114
+
115
+ **By base language.** `test` has the same number of texts for every language.
116
+
117
+ | Language | Code | train texts | test texts | train rows | test rows |
118
+ |---|---|---|---|---|---|
119
+ | Afrikaans | `afr` | 240 | 300 | 480 | 600 |
120
+ | Amharic | `amh` | 240 | 300 | 480 | 600 |
121
+ | Bambara | `bam` | 241 | 300 | 482 | 600 |
122
+ | Cameroonian Pidgin | `wes` | 241 | 300 | 446 | 557 |
123
+ | Chichewa | `nya` | 239 | 300 | 478 | 600 |
124
+ | Ewe | `ewe` | 241 | 300 | 482 | 599 |
125
+ | Fon | `fon` | 241 | 300 | 482 | 600 |
126
+ | Fulah | `ful` | 241 | 300 | 482 | 600 |
127
+ | Ghanaian Pidgin | `gpe` | 242 | 300 | 476 | 591 |
128
+ | Hausa | `hau` | 241 | 300 | 482 | 600 |
129
+ | Igbo | `ibo` | 241 | 300 | 482 | 600 |
130
+ | Kikuyu | `kik` | 241 | 300 | 482 | 600 |
131
+ | Kinyarwanda | `kin` | 242 | 300 | 484 | 600 |
132
+ | Kirundi | `run` | 241 | 300 | 482 | 600 |
133
+ | Kongo | `kon` | 241 | 300 | 482 | 600 |
134
+ | Lingala | `lin` | 242 | 300 | 484 | 600 |
135
+ | Luganda | `lug` | 242 | 300 | 484 | 600 |
136
+ | Luo | `luo` | 241 | 300 | 482 | 600 |
137
+ | Malagasy | `mlg` | 242 | 300 | 484 | 600 |
138
+ | Nigerian Pidgin | `pcm` | 242 | 300 | 484 | 600 |
139
+ | North Ndebele | `nde` | 241 | 300 | 482 | 600 |
140
+ | Oromo | `orm` | 240 | 300 | 480 | 600 |
141
+ | Sepedi | `nso` | 242 | 300 | 484 | 600 |
142
+ | Sesotho | `sot` | 241 | 300 | 482 | 600 |
143
+ | Setswana | `tsn` | 241 | 300 | 482 | 600 |
144
+ | Shona | `sna` | 241 | 300 | 482 | 600 |
145
+ | Somali | `som` | 241 | 300 | 482 | 600 |
146
+ | Swahili | `swh` | 242 | 300 | 484 | 600 |
147
+ | Swati | `ssw` | 239 | 300 | 478 | 600 |
148
+ | Tigrinya | `tir` | 241 | 300 | 482 | 600 |
149
+ | Tsonga | `tso` | 242 | 300 | 484 | 600 |
150
+ | Tumbuka | `tum` | 241 | 300 | 482 | 600 |
151
+ | Twi | `twi` | 241 | 300 | 482 | 600 |
152
+ | Wolof | `wol` | 241 | 300 | 482 | 600 |
153
+ | Xhosa | `xho` | 242 | 300 | 484 | 600 |
154
+ | Yoruba | `yor` | 240 | 300 | 480 | 600 |
155
+ | Zulu | `zul` | 241 | 300 | 482 | 600 |
156
+
157
+ **By base-switch language pair** (`hm` rows). The last column tells whether our 1B model was trained on this pair. The 3,348 rows of the pairs marked "no" come from an earlier, wider pair list; the model's candidates for them are less reliable, so filter on `pair_in_training_table` if you need only the supported pairs.
158
+
159
+ | Base | Code | Switch | Code | train | test | total | in the 1B training table |
160
+ |---|---|---|---|---|---|---|---|
161
+ | Afrikaans | `afr` | English | `eng` | 117 | 146 | 263 | yes |
162
+ | Afrikaans | `afr` | Zulu | `zul` | 123 | 154 | 277 | no |
163
+ | Amharic | `amh` | Arabic | `ara` | 131 | 164 | 295 | no |
164
+ | Amharic | `amh` | English | `eng` | 109 | 136 | 245 | yes |
165
+ | Bambara | `bam` | French | `fra` | 115 | 143 | 258 | yes |
166
+ | Bambara | `bam` | Wolof | `wol` | 126 | 157 | 283 | no |
167
+ | Cameroonian Pidgin | `wes` | Duala | `dua` | 53 | 68 | 121 | no |
168
+ | Cameroonian Pidgin | `wes` | Ewondo | `ewo` | 79 | 97 | 176 | no |
169
+ | Cameroonian Pidgin | `wes` | French | `fra` | 73 | 92 | 165 | yes |
170
+ | Chichewa | `nya` | English | `eng` | 111 | 141 | 252 | yes |
171
+ | Chichewa | `nya` | Tumbuka | `tum` | 128 | 159 | 287 | yes |
172
+ | Ewe | `ewe` | English | `eng` | 117 | 147 | 264 | yes |
173
+ | Ewe | `ewe` | French | `fra` | 124 | 153 | 277 | yes |
174
+ | Fon | `fon` | French | `fra` | 128 | 160 | 288 | yes |
175
+ | Fon | `fon` | Yoruba | `yor` | 113 | 140 | 253 | yes |
176
+ | Fulah | `ful` | English | `eng` | 121 | 151 | 272 | yes |
177
+ | Fulah | `ful` | French | `fra` | 120 | 149 | 269 | yes |
178
+ | Ghanaian Pidgin | `gpe` | Ewe | `ewe` | 78 | 96 | 174 | yes |
179
+ | Ghanaian Pidgin | `gpe` | Ga | `gaa` | 73 | 92 | 165 | yes |
180
+ | Ghanaian Pidgin | `gpe` | Twi | `twi` | 83 | 103 | 186 | yes |
181
+ | Hausa | `hau` | Arabic | `ara` | 119 | 150 | 269 | yes |
182
+ | Hausa | `hau` | English | `eng` | 122 | 150 | 272 | yes |
183
+ | Igbo | `ibo` | English | `eng` | 112 | 139 | 251 | yes |
184
+ | Igbo | `ibo` | Nigerian Pidgin | `pcm` | 129 | 161 | 290 | yes |
185
+ | Kikuyu | `kik` | English | `eng` | 116 | 143 | 259 | yes |
186
+ | Kikuyu | `kik` | Swahili | `swh` | 125 | 157 | 282 | yes |
187
+ | Kinyarwanda | `kin` | English | `eng` | 83 | 103 | 186 | yes |
188
+ | Kinyarwanda | `kin` | French | `fra` | 78 | 96 | 174 | yes |
189
+ | Kinyarwanda | `kin` | Swahili | `swh` | 81 | 101 | 182 | yes |
190
+ | Kirundi | `run` | French | `fra` | 128 | 159 | 287 | yes |
191
+ | Kirundi | `run` | Swahili | `swh` | 113 | 141 | 254 | yes |
192
+ | Kongo | `kon` | French | `fra` | 117 | 145 | 262 | yes |
193
+ | Kongo | `kon` | Lingala | `lin` | 124 | 155 | 279 | yes |
194
+ | Lingala | `lin` | French | `fra` | 108 | 134 | 242 | yes |
195
+ | Lingala | `lin` | Kongo | `kon` | 134 | 166 | 300 | no |
196
+ | Luganda | `lug` | English | `eng` | 114 | 142 | 256 | yes |
197
+ | Luganda | `lug` | Swahili | `swh` | 128 | 158 | 286 | yes |
198
+ | Luo | `luo` | English | `eng` | 117 | 146 | 263 | yes |
199
+ | Luo | `luo` | Swahili | `swh` | 124 | 154 | 278 | yes |
200
+ | Malagasy | `mlg` | English | `eng` | 120 | 149 | 269 | no |
201
+ | Malagasy | `mlg` | French | `fra` | 122 | 151 | 273 | yes |
202
+ | Nigerian Pidgin | `pcm` | Hausa | `hau` | 83 | 103 | 186 | yes |
203
+ | Nigerian Pidgin | `pcm` | Igbo | `ibo` | 81 | 102 | 183 | yes |
204
+ | Nigerian Pidgin | `pcm` | Yoruba | `yor` | 78 | 95 | 173 | yes |
205
+ | North Ndebele | `nde` | English | `eng` | 125 | 155 | 280 | yes |
206
+ | North Ndebele | `nde` | Shona | `sna` | 116 | 145 | 261 | yes |
207
+ | Oromo | `orm` | Amharic | `amh` | 117 | 145 | 262 | yes |
208
+ | Oromo | `orm` | English | `eng` | 123 | 155 | 278 | yes |
209
+ | Sepedi | `nso` | Afrikaans | `afr` | 124 | 154 | 278 | no |
210
+ | Sepedi | `nso` | English | `eng` | 118 | 146 | 264 | yes |
211
+ | Sesotho | `sot` | Afrikaans | `afr` | 123 | 152 | 275 | yes |
212
+ | Sesotho | `sot` | English | `eng` | 118 | 148 | 266 | yes |
213
+ | Setswana | `tsn` | Afrikaans | `afr` | 115 | 143 | 258 | yes |
214
+ | Setswana | `tsn` | English | `eng` | 126 | 157 | 283 | yes |
215
+ | Shona | `sna` | English | `eng` | 131 | 162 | 293 | yes |
216
+ | Shona | `sna` | North Ndebele | `nde` | 110 | 138 | 248 | no |
217
+ | Somali | `som` | Amharic | `amh` | 54 | 66 | 120 | no |
218
+ | Somali | `som` | Arabic | `ara` | 65 | 81 | 146 | yes |
219
+ | Somali | `som` | English | `eng` | 58 | 74 | 132 | yes |
220
+ | Somali | `som` | Italian | `ita` | 64 | 79 | 143 | no |
221
+ | Swahili | `swh` | Arabic | `ara` | 73 | 91 | 164 | yes |
222
+ | Swahili | `swh` | English | `eng` | 86 | 108 | 194 | yes |
223
+ | Swahili | `swh` | Sheng | `sheng` | 83 | 101 | 184 | yes |
224
+ | Swati | `ssw` | English | `eng` | 116 | 145 | 261 | yes |
225
+ | Swati | `ssw` | Zulu | `zul` | 123 | 155 | 278 | yes |
226
+ | Tigrinya | `tir` | Amharic | `amh` | 118 | 147 | 265 | yes |
227
+ | Tigrinya | `tir` | English | `eng` | 123 | 153 | 276 | yes |
228
+ | Tsonga | `tso` | English | `eng` | 122 | 151 | 273 | yes |
229
+ | Tsonga | `tso` | Zulu | `zul` | 120 | 149 | 269 | yes |
230
+ | Tumbuka | `tum` | Chichewa | `nya` | 112 | 139 | 251 | yes |
231
+ | Tumbuka | `tum` | English | `eng` | 129 | 161 | 290 | yes |
232
+ | Twi | `twi` | English | `eng` | 126 | 155 | 281 | yes |
233
+ | Twi | `twi` | Ghanaian Pidgin | `gpe` | 115 | 145 | 260 | yes |
234
+ | Wolof | `wol` | Arabic | `ara` | 127 | 158 | 285 | no |
235
+ | Wolof | `wol` | French | `fra` | 114 | 142 | 256 | yes |
236
+ | Xhosa | `xho` | Afrikaans | `afr` | 122 | 151 | 273 | no |
237
+ | Xhosa | `xho` | English | `eng` | 120 | 149 | 269 | yes |
238
+ | Yoruba | `yor` | English | `eng` | 115 | 143 | 258 | yes |
239
+ | Yoruba | `yor` | Nigerian Pidgin | `pcm` | 125 | 157 | 282 | yes |
240
+ | Zulu | `zul` | Afrikaans | `afr` | 125 | 155 | 280 | no |
241
+ | Zulu | `zul` | English | `eng` | 116 | 145 | 261 | yes |
242
+
243
+ ## Supported prompt formats
244
+
245
+ Prompts use the formats `<hm> <base>+<switch>: TEXT` and `<ood> <base>: TEXT`, with the three-letter language codes in angle brackets and two spaces after the colon.
246
 
247
  ## Limitations
248
 
249
+ - **Our goal is for this to become the standard benchmark for African-language code-switching**, so that progress can be measured and the languages are better represented. It is not there yet. The candidates were written by a model and have not been checked by native speakers, so for now treat them as references of unknown quality. Human-verified references will replace them, and we welcome contributions, especially from speakers of the 37 languages.
250
+ - Expect unnatural phrasing, invented idioms, wrong tone marks and changes of meaning in the candidates. Pidgin outputs keep a lot of English.
251
+ - The sampled candidates are plain temperature samples, and many are worse than the greedy one. Scores are not comparable across languages, and `ev` likes short, simple code-switching, so don't rank by it blindly.
252
+ - Rows with `pair_in_training_table` set to `false` are less reliable, as explained above.
253
 
254
  ## License
255
 
256
+ The English source texts keep the licences of their sources: SODA and Synthetic-Persona-Chat are CC BY 4.0, WritingPrompts is MIT, the FineWeb-Edu sample is ODC-By, and Project Gutenberg texts are public domain. CC BY 4.0 and ODC-By require attribution to the original datasets. The generated outputs come from a Gemma-based model, so the [Gemma Terms of Use](https://ai.google.dev/gemma/terms) apply to them. Credit "AletheiaAING" if you use the dataset.
data/{out_scored.jsonl.gz → new_english_prompts.jsonl.gz} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fd63042d67f24e4f32d8946bb7315381d1e618684dd2857c68be3679e9f8bed7
3
- size 62912772
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:204b946f08654eaa8faf31bcbb37cd4c62065009c36682de1b7e77933b8c8dc6
3
+ size 4100958
data/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffff5875a95f2d6a57b81d0860fb69dae0d24ccfa19a8e6d230cb183ca89decf
3
+ size 36269051
data/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:050e1a4c89d919e59a73103e5984345dec9efb3fd101f1d0fef48145543a9fd5
3
+ size 29002427
generate_train_extra.ipynb ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 5,
4
+ "metadata": {
5
+ "accelerator": "GPU",
6
+ "colab": {
7
+ "gpuType": "T4",
8
+ "provenance": []
9
+ },
10
+ "kernelspec": {
11
+ "display_name": "Python 3",
12
+ "name": "python3"
13
+ },
14
+ "language_info": {
15
+ "name": "python"
16
+ }
17
+ },
18
+ "cells": [
19
+ {
20
+ "cell_type": "markdown",
21
+ "metadata": {},
22
+ "source": [
23
+ "# Grow the train set with new English texts\n",
24
+ "\n",
25
+ "This notebook writes code-switched (`hm`) and idiom-rich (`ood`) versions of the new English texts in\n",
26
+ "[`AletheiaAING/african-code-switch-benchmark`](https://huggingface.co/datasets/AletheiaAING/african-code-switch-benchmark), using our 8-bit model\n",
27
+ "[`AletheiaAING/gemma-3-0.8b-csw`](https://huggingface.co/AletheiaAING/gemma-3-0.8b-csw) with llama.cpp.\n",
28
+ "\n",
29
+ "**What it does**\n",
30
+ "1. Builds llama.cpp with CUDA and starts a local server with the 8-bit model.\n",
31
+ "2. Reads `data/new_english_prompts.jsonl.gz` from the dataset repo: about 25,000 new English texts, each assigned a base language and a switch language, so 2 prompts per text.\n",
32
+ "3. Generates `N_CANDIDATES` candidates per prompt (the first is greedy, the rest are sampled) and cleans them into the same columns as the train set (`candidates`, `output`, ...).\n",
33
+ "4. Saves shards as it goes, so you can stop and resume. Writes `train_extra.jsonl.gz` at the end and can upload it to the dataset repo.\n",
34
+ "\n",
35
+ "**Runtime.** Use a GPU runtime (T4 is enough). Speed is roughly 1,000 to 2,000 generated tokens per second on a T4, so with `N_CANDIDATES = 2` expect around 6 to 8 hours for everything. Run a part first with `MAX_TEXTS` and raise it later. Rows have no `ev` score, because the scoring model is private."
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "metadata": {},
41
+ "source": [
42
+ "import subprocess, shutil, os\n",
43
+ "# Build llama.cpp with CUDA (about 10 minutes the first time)\n",
44
+ "if not os.path.exists(\"llama.cpp/build/bin/llama-server\"):\n",
45
+ " subprocess.run(\"git clone --depth 1 https://github.com/ggml-org/llama.cpp\", shell=True, check=True)\n",
46
+ " subprocess.run(\"cmake -S llama.cpp -B llama.cpp/build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=native -DLLAMA_CURL=OFF\", shell=True, check=True)\n",
47
+ " subprocess.run(\"cmake --build llama.cpp/build --config Release -j 4 --target llama-server\", shell=True, check=True)\n",
48
+ "subprocess.run(\"pip -q install huggingface_hub\", shell=True, check=True)\n",
49
+ "print(\"ready\")"
50
+ ],
51
+ "outputs": [],
52
+ "execution_count": null
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "metadata": {},
57
+ "source": [
58
+ "# ---- settings ----\n",
59
+ "DATASET = \"AletheiaAING/african-code-switch-benchmark\"\n",
60
+ "MODEL = \"AletheiaAING/gemma-3-0.8b-csw\"\n",
61
+ "GGUF = \"csw-gemma3-1b-rl3-pruned-Q8_0.gguf\"\n",
62
+ "N_CANDIDATES = 2 # 1 greedy + (N-1) sampled at temperature 0.8. The main dataset has 8; raise it if you have time.\n",
63
+ "MAX_TEXTS = None # for a quick test use e.g. 200; None = all texts\n",
64
+ "PARALLEL = 16 # simultaneous requests handled by the server\n",
65
+ "SAVE_DIR = \"/content/drive/MyDrive/csw_extra\" # shards are saved here so a disconnect doesn't lose work\n",
66
+ "UPLOAD = False # True: upload train_extra.jsonl.gz to the dataset repo at the end (needs an HF write token in Colab secrets named HF_TOKEN)"
67
+ ],
68
+ "outputs": [],
69
+ "execution_count": null
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "metadata": {},
74
+ "source": [
75
+ "# Save shards to Google Drive (skip this cell to save to the local disk instead)\n",
76
+ "try:\n",
77
+ " from google.colab import drive\n",
78
+ " drive.mount(\"/content/drive\")\n",
79
+ "except Exception as e:\n",
80
+ " SAVE_DIR = \"csw_extra\"; print(\"no Drive, saving to\", SAVE_DIR)\n",
81
+ "os.makedirs(SAVE_DIR, exist_ok=True)"
82
+ ],
83
+ "outputs": [],
84
+ "execution_count": null
85
+ },
86
+ {
87
+ "cell_type": "code",
88
+ "metadata": {},
89
+ "source": [
90
+ "import gzip, json, re, time, subprocess, threading, urllib.request, collections as C\n",
91
+ "from concurrent.futures import ThreadPoolExecutor\n",
92
+ "from huggingface_hub import hf_hub_download\n",
93
+ "\n",
94
+ "gguf_path = hf_hub_download(MODEL, GGUF)\n",
95
+ "prompts_path = hf_hub_download(DATASET, \"data/new_english_prompts.jsonl.gz\", repo_type=\"dataset\")\n",
96
+ "rows = [json.loads(l) for l in gzip.open(prompts_path, \"rt\", encoding=\"utf-8\")]\n",
97
+ "if MAX_TEXTS:\n",
98
+ " keep = sorted({r[\"id\"] for r in rows})[:MAX_TEXTS]; keep = set(keep); rows = [r for r in rows if r[\"id\"] in keep]\n",
99
+ "print(len(rows), \"prompts,\", len({r[\"id\"] for r in rows}), \"texts,\", len({r[\"lang\"] for r in rows}), \"languages\")"
100
+ ],
101
+ "outputs": [],
102
+ "execution_count": null
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "metadata": {},
107
+ "source": [
108
+ "# Start the server with the 8-bit model (context is shared between the parallel slots)\n",
109
+ "SERVER = os.environ.get(\"LLAMA_SERVER\", \"llama.cpp/build/bin/llama-server\")\n",
110
+ "NGL = os.environ.get(\"NGL\", \"99\")\n",
111
+ "proc = subprocess.Popen([SERVER, \"-m\", gguf_path, \"-c\", str(1536 * PARALLEL), \"-np\", str(PARALLEL), \"-ngl\", NGL, \"--port\", \"8089\", \"--host\", \"127.0.0.1\"],\n",
112
+ " stdout=open(\"server.log\", \"w\"), stderr=subprocess.STDOUT)\n",
113
+ "for _ in range(180):\n",
114
+ " try:\n",
115
+ " urllib.request.urlopen(\"http://127.0.0.1:8089/health\", timeout=2); break\n",
116
+ " except Exception: time.sleep(2)\n",
117
+ "else:\n",
118
+ " raise RuntimeError(\"server did not start, see server.log\")\n",
119
+ "print(\"server up\")"
120
+ ],
121
+ "outputs": [],
122
+ "execution_count": null
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "metadata": {},
127
+ "source": [
128
+ "TAGS = re.compile(r\"^((?:<(?!/?dev>)\\w{1,8}>)+)\"); DEV = re.compile(r\"^\\s*<dev>(.*?)</dev>\", re.S)\n",
129
+ "URL = \"http://127.0.0.1:8089/v1/chat/completions\"\n",
130
+ "\n",
131
+ "def ask(prompt, temperature, seed):\n",
132
+ " body = {\"messages\": [{\"role\": \"user\", \"content\": prompt}], \"temperature\": temperature, \"max_tokens\": 640, \"seed\": seed}\n",
133
+ " if temperature > 0: body[\"top_p\"] = 1.0; body[\"top_k\"] = 0\n",
134
+ " req = urllib.request.Request(URL, json.dumps(body).encode(), {\"Content-Type\": \"application/json\"})\n",
135
+ " for attempt in range(3):\n",
136
+ " try:\n",
137
+ " r = json.loads(urllib.request.urlopen(req, timeout=900).read())[\"choices\"][0]; return r[\"message\"][\"content\"], r.get(\"finish_reason\") == \"stop\"\n",
138
+ " except Exception: time.sleep(2)\n",
139
+ " return \"\", False\n",
140
+ "\n",
141
+ "def clean(text):\n",
142
+ " c = text.replace(\"<end_of_turn>\", \"\").strip(); m = TAGS.match(c); c = c[m.end():].lstrip() if m else c\n",
143
+ " d = DEV.match(c); return (c[d.end():].strip() if d else c), ([x.strip() for x in d.group(1).split(\"|\") if x.strip()] if d else [])\n",
144
+ "\n",
145
+ "def make_row(r):\n",
146
+ " cands = []\n",
147
+ " for k in range(N_CANDIDATES):\n",
148
+ " text, finished = ask(r[\"prompt\"], 0.0 if k == 0 else 0.8, 1000 + k)\n",
149
+ " final, devices = clean(text)\n",
150
+ " c = {\"k\": k, \"greedy\": k == 0, \"text\": text, \"finished\": finished, \"devices\": devices, \"final\": final,\n",
151
+ " \"format_ok\": bool(TAGS.match(text.strip()) and DEV.search(TAGS.sub(\"\", text.strip(), count=1).lstrip()) and final and finished)}\n",
152
+ " cands.append(c)\n",
153
+ " out = dict(r); out[\"pair_in_training_table\"] = True; out[\"candidates\"] = cands; out[\"output\"] = [c[\"final\"] for c in cands]\n",
154
+ " return out"
155
+ ],
156
+ "outputs": [],
157
+ "execution_count": null
158
+ },
159
+ {
160
+ "cell_type": "code",
161
+ "metadata": {},
162
+ "source": [
163
+ "# Generate in shards of 1,000 rows. Finished shards are skipped when you run this cell again.\n",
164
+ "SHARD = 1000\n",
165
+ "todo = sorted(rows, key=lambda r: (r[\"id\"], r[\"task\"]))\n",
166
+ "t0 = time.time()\n",
167
+ "for s in range(0, len(todo), SHARD):\n",
168
+ " path = os.path.join(SAVE_DIR, f\"shard_{s // SHARD:04d}.jsonl.gz\")\n",
169
+ " if os.path.exists(path): continue\n",
170
+ " with ThreadPoolExecutor(PARALLEL) as ex: done = list(ex.map(make_row, todo[s:s + SHARD]))\n",
171
+ " with gzip.open(path + \".tmp\", \"wt\", encoding=\"utf-8\") as fo:\n",
172
+ " for r in done: fo.write(json.dumps(r, ensure_ascii=False) + \"\\n\")\n",
173
+ " os.replace(path + \".tmp\", path)\n",
174
+ " print(f\"shard {s // SHARD} done, {s + len(done)} / {len(todo)} rows, {(time.time() - t0) / 60:.1f} min\", flush=True)"
175
+ ],
176
+ "outputs": [],
177
+ "execution_count": null
178
+ },
179
+ {
180
+ "cell_type": "code",
181
+ "metadata": {},
182
+ "source": [
183
+ "# Collect the shards into train_extra.jsonl.gz and print a summary\n",
184
+ "import glob\n",
185
+ "out_rows = [json.loads(l) for p in sorted(glob.glob(os.path.join(SAVE_DIR, \"shard_*.jsonl.gz\"))) for l in gzip.open(p, \"rt\", encoding=\"utf-8\")]\n",
186
+ "final_path = os.path.join(SAVE_DIR, \"train_extra.jsonl.gz\")\n",
187
+ "with gzip.open(final_path, \"wt\", encoding=\"utf-8\") as fo:\n",
188
+ " for r in out_rows: fo.write(json.dumps(r, ensure_ascii=False) + \"\\n\")\n",
189
+ "cs = [c for r in out_rows for c in r[\"candidates\"]]\n",
190
+ "print(len(out_rows), \"rows,\", len(cs), \"candidates, format ok:\", round(sum(c[\"format_ok\"] for c in cs) / max(1, len(cs)), 3))\n",
191
+ "print(C.Counter(r[\"lang\"] for r in out_rows).most_common(3), \"...\")\n",
192
+ "r = out_rows[0]; print(r[\"prompt\"][:120]); print(r[\"output\"][0][:200])"
193
+ ],
194
+ "outputs": [],
195
+ "execution_count": null
196
+ },
197
+ {
198
+ "cell_type": "code",
199
+ "metadata": {},
200
+ "source": [
201
+ "if UPLOAD:\n",
202
+ " from google.colab import userdata\n",
203
+ " from huggingface_hub import HfApi\n",
204
+ " HfApi(token=userdata.get(\"HF_TOKEN\")).upload_file(path_or_fileobj=final_path, path_in_repo=\"data/train_extra.jsonl.gz\", repo_id=DATASET, repo_type=\"dataset\", commit_message=\"Add generated train_extra\")\n",
205
+ " print(\"uploaded\")\n",
206
+ "proc.terminate()"
207
+ ],
208
+ "outputs": [],
209
+ "execution_count": null
210
+ }
211
+ ]
212
+ }