Datasets:
ArXiv:
License:
GAOXinyu
commited on
Commit
•
2f0e60b
1
Parent(s):
b4ddf86
INIT: init
Browse files- PretrainCorpusDemo.py +110 -0
- README.md +2 -0
- data/train.json +10 -0
PretrainCorpusDemo.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
"""Demo for pretrain"""
|
16 |
+
|
17 |
+
|
18 |
+
import os
|
19 |
+
import json
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
|
23 |
+
_CITATION = """\
|
24 |
+
"""
|
25 |
+
|
26 |
+
_DESCRIPTION = """\
|
27 |
+
"""
|
28 |
+
|
29 |
+
_LICENSE = "apache-license-2.0"
|
30 |
+
_HOMEPAGE = "https://github.com/IDEA-CCNL/Fengshenbang-LM"
|
31 |
+
|
32 |
+
|
33 |
+
class Config(datasets.BuilderConfig):
|
34 |
+
"""BuilderConfig for Demo"""
|
35 |
+
|
36 |
+
def __init__(self, **kwargs):
|
37 |
+
super().__init__(**kwargs)
|
38 |
+
"""
|
39 |
+
Args:
|
40 |
+
**kwargs: keyword arguments forwarded to super.
|
41 |
+
"""
|
42 |
+
|
43 |
+
|
44 |
+
class PretrainCorpusDemo(datasets.GeneratorBasedBuilder):
|
45 |
+
|
46 |
+
VERSION = datasets.Version("1.0.0")
|
47 |
+
|
48 |
+
BUILDER_CONFIG_CLASS = Config
|
49 |
+
BUILDER_CONFIGS = [
|
50 |
+
Config(description=_DESCRIPTION)
|
51 |
+
]
|
52 |
+
|
53 |
+
def _info(self):
|
54 |
+
return datasets.DatasetInfo(
|
55 |
+
description=_DESCRIPTION,
|
56 |
+
features=datasets.Features({
|
57 |
+
"text": datasets.Value("string"),
|
58 |
+
}),
|
59 |
+
homepage=_HOMEPAGE,
|
60 |
+
citation=_CITATION,
|
61 |
+
license=_LICENSE
|
62 |
+
)
|
63 |
+
|
64 |
+
def _split_generators(self, dl_manager):
|
65 |
+
|
66 |
+
files = {
|
67 |
+
"test": os.path.join("data", f"train.json"),
|
68 |
+
"validation": os.path.join("data", f"train.json"),
|
69 |
+
"train": os.path.join("data", f"train.json"),
|
70 |
+
}
|
71 |
+
data_dir = dl_manager.download_and_extract(files)
|
72 |
+
|
73 |
+
output = []
|
74 |
+
test = datasets.SplitGenerator(
|
75 |
+
name=datasets.Split.TEST,
|
76 |
+
gen_kwargs={
|
77 |
+
"filepath": data_dir["test"]
|
78 |
+
}
|
79 |
+
)
|
80 |
+
output.append(test)
|
81 |
+
|
82 |
+
# if os.path.exists(data_dir["validation"]):
|
83 |
+
valid = datasets.SplitGenerator(
|
84 |
+
name=datasets.Split.VALIDATION,
|
85 |
+
gen_kwargs={
|
86 |
+
"filepath": data_dir["validation"]
|
87 |
+
}
|
88 |
+
)
|
89 |
+
output.append(valid)
|
90 |
+
|
91 |
+
train = datasets.SplitGenerator(
|
92 |
+
name=datasets.Split.TRAIN,
|
93 |
+
gen_kwargs={
|
94 |
+
"filepath": data_dir["train"]
|
95 |
+
}
|
96 |
+
)
|
97 |
+
output.append(train)
|
98 |
+
|
99 |
+
return output
|
100 |
+
|
101 |
+
def _generate_examples(self, filepath):
|
102 |
+
"""Yields examples."""
|
103 |
+
with open(filepath, encoding="utf-8") as f:
|
104 |
+
lines = f.readlines()
|
105 |
+
for id_, line in enumerate(lines):
|
106 |
+
data = json.loads(line)
|
107 |
+
s = {
|
108 |
+
'text': data['text'],
|
109 |
+
}
|
110 |
+
yield id_, s
|
README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
Only use for Demo
|
data/train.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"text": "粤港澳大湾区数字经济研究院(International Digital Economy Academy 简称“IDEA”)是一家面向人工智能(Artificial Intelligence,简称“AI”)、数字经济产业和前沿科技的国际化创新型研究机构,坐落于深圳市深港科技创新合作区内。"}
|
2 |
+
{"text": "IDEA正与MSR、Google Brain、DeepMind、OpenAI等同行者一起推动人类AI技术前沿的发展。IDEA的使命是立足社会需求,研发颠覆式创新技术并回馈社会,让更多的人从数字经济发展中获益。IDEA秉承共享共赢共生的开源开放精神,积极营造自由而富有激情的创新工作环境,聚集全世界最聪慧的大脑一起创造人类社会最需要的价值。我们坚持科技擎天,产业立地,相信最好的研究从需求中来,到需求中去,最终惠及广大企业和受众。"}
|
3 |
+
{"text": "IDEA目前已聚集一批包括院士、世界著名大学教授、世界知名开源系统发明人在内的国际一流技术专家,致力于在AI基础技术与开源系统、人工智能金融科技、区块链技术与机密计算、企业级AI系统、产业智能物联网与智能机器人等领域研发国际顶尖成果,并培育一批国际领先科技企业,带动深圳乃至大湾区万亿级数字经济产业发展。"}
|
4 |
+
{"text": "2021年11月22日,IDEA研究院创院理事长沈向洋在IDEA大会上正式宣布启动 “封神榜”大模型开源计划。目前,我们已经开源了6个系列共10个模型,包含4种模型结构,模型参数最大达到35亿。"}
|
5 |
+
{"text": "二郎神系列:以Encoder结构为主的双向语言系列模型,专注于解决各种自然语言理解任务。本系列中13亿参数的“Erlangshen-MegatronBert-1.3B”大模型,是目前中文领域内最大的开源Bert大模型。2021年11月及2022年1月,“二郎神”在中文语言理解权威评测基准FewCLUE 在新窗口查看和ZeroCLUE 在新窗口查看双料榜单上登顶,2022年3月在Hugging Face的单月下载量突破1k。同时IDEA研究院CCNL也开源了解决长文本分类任务的“Erlangshen-Longformer-110M”和“Erlangshen-Longformer-330M”。"}
|
6 |
+
{"text": "周文王系列:是IDEA研究院与追一科技联合开发的一系列新结构大模型。目前开源的13亿参数“Zhouwenwang-Unified-1.3B”大模型,是中文领域内可同时做LM和MLM任务的最大模型。"}
|
7 |
+
{"text": "余元系列:本系列模型主要面向医疗领域。拥有35亿参数的“Yuyuan-GPT2-3.5B”大模型,对英文医疗事实判断准确率接近90%。由 “Yuyuan-GPT2-3.5B”微调而来的问答模型“YuyuanQA-GPT2-3.5B”,在100个英文医疗问答任务上的Bleu值达到了0.35。"}
|
8 |
+
{"text": "闻仲系列:以Decoder结构为主的单向语言模型,是一系列强大的生成模型,目前开源了35亿参数的“Wenzhong-GPT2-3.5B”大模型。"}
|
9 |
+
{"text": "燃灯系列:本系列是以Transformer结构为主的编解码语言模型,主要解决通用任务,目前开源了7.7亿参数的“Randeng-MegatronT5-770M”大模型。"}
|
10 |
+
{"text": "比干系列:本系列主要面向各种纠错任务,目前开源了11亿参数的“Bigan-Transformer-XL-denoise-1.1B”大模型。"}
|