File size: 993 Bytes
b838b2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Retain the RU/EN/ZH dataset, updating only three answers about the model size."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]


def main():
    rows = [json.loads(s) for s in (ROOT/'data/26m/train.jsonl').read_text().splitlines()]
    answers = {
        'Сколько у тебя параметров сейчас?': 'В этой версии ровно 41 миллион параметров.',
        'How many parameters do you have?': 'This version has exactly 41 million parameters.',
        '你有多少参数?': '这个版本正好有 4100 万个参数。',
    }
    rows = [{**r, 'answer': answers.get(r['question'], r['answer'])} for r in rows]
    dest = ROOT/'data/41m'
    dest.mkdir(exist_ok=True)
    (dest/'train.jsonl').write_text(''.join(json.dumps(r, ensure_ascii=False)+'\n' for r in rows), encoding='utf-8')
    print(len(rows), 'examples; only the 3 parameter-count answers changed')


if __name__ == '__main__':
    main()