Datasets:
Dataset Viewer
The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
FineWeb-Edu 10B Tokens (NPY Format)
数据集概述
这是一个预处理好的教育文本数据集,包含约100亿个tokens,专门为训练小型语言模型(如GPT-2 124M)而设计。数据来源于高质量的FineWeb-Edu数据集,已经使用GPT-2的tiktoken分词器进行预处理,并保存为numpy格式以提高训练效率。 Followed by Let's reproduce GPT-2 (124M). Thanks to Andrej Karpathy!!!
🎯 适用场景
- 小型语言模型训练:特别适合GPT-2 124M/350M等参数规模的模型
- 教育研究:高质量教育内容,适合教学和学术研究
- 快速原型开发:预处理完成,可直接用于训练间
📊 数据统计
- 总token数量:~10,000,000,000 tokens
- 分片大小:100M tokens/分片
- 数据格式:numpy (.npy) uint16数组
- 分词器:GPT-2 tiktoken
- 语言:英语
- 质量:高质量教育内容(来自FineWeb-Edu筛选)
📁 文件结构
├── edufineweb_val_000000.npy # 验证集 (100M tokens)
├── edufineweb_train_000001.npy # 训练集分片1 (100M tokens)
├── edufineweb_train_000002.npy # 训练集分片2 (100M tokens)
├── ...
└── edufineweb_train_000099.npy # 训练集分片99 (100M tokens)
🚀 使用方法
快速开始
import numpy as np
from datasets import load_dataset
# 方法1:使用 datasets 库
dataset = load_dataset("ShallowU/FineWeb-Edu-10B-Tokens-NPY")
# 方法2:直接加载numpy文件
train_tokens = np.load("edufineweb_train_000001.npy")
val_tokens = np.load("edufineweb_val_000000.npy")
print(f"训练tokens形状: {train_tokens.shape}")
print(f"验证tokens形状: {val_tokens.shape}")
用于GPT-2训练
class DataLoaderLite:
def __init__(self, B, T, process_rank, num_processes, split):
self.B = B
self.T = T
self.process_rank = process_rank
self.num_processes = num_processes
assert split in {'train', 'val'}
# 加载对应的分片
if split == 'train':
data_root = "path/to/dataset"
shards = [f"edufineweb_train_{i:06d}.npy" for i in range(1, 100)]
else:
shards = ["edufineweb_val_000000.npy"]
self.tokens = np.concatenate([
np.load(os.path.join(data_root, shard)) for shard in shards
])
def next_batch(self):
B, T = self.B, self.T
buf = self.tokens[self.current_position:self.current_position+B*T+1]
x = torch.tensor(buf[:-1]).view(B, T) # inputs
y = torch.tensor(buf[1:]).view(B, T) # targets
self.current_position += B * T * self.num_processes
return x, y
🔧 技术规格
- 分词器:
tiktoken.get_encoding("gpt2")
- 词汇表大小:50,257
- 特殊token:
<|endoftext|>
(token_id: 50256) - 数据类型:
numpy.uint16
- 文件格式:
.npy
📈 训练建议
推荐配置 (GPT-2 124M)
# 训练参数
batch_size = 64
sequence_length = 1024
learning_rate = 6e-4
warmup_steps = 715
max_steps = 19073 # ~10B tokens
# 模型配置
model_config = {
'vocab_size': 50304, # 向上取整到64的倍数,no ugly number
'n_embd': 768,
'n_head': 12,
'n_layer': 12,
'block_size': 1024
}
🙏 致谢
感谢以下项目和团队:
- HuggingFace FineWeb团队 提供高质量数据集
- OpenAI tiktoken 提供分词器
- Andrej Kaparthy's video
- 教育内容创作者和开源社区
📄 许可证
MIT License - 欢迎用于学术研究和教育目的
注意:此数据集专为教育和研究目的设计,使用时请遵守相应的伦理准则和法律法规。
- Downloads last month
- 197