The Stack v2
The largest open code dataset ever assembled: 900 billion tokens across 600+ programming languages sourced from GitHub, with an opt-out mechanism for developers. Powers StarCoder2 and is the go-to pretraining corpus for code LLMs. Includes permissively-licensed repos with deduplication and near-deduplication passes.
加载
from datasets import load_dataset
ds = load_dataset("bigcode/the-stack-v2")预览示例数据
{
"content": "def binary_search(arr, target):\n left, right = 0, len(arr) - 1\n while left <= right:\n mid = (left + right) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n left = mid + 1\n else:\n right = mid - 1\n return -1",
"lang": "Python",
"license": "MIT"
}常见问题
The Stack v2 可以商用吗?
请先核实条款——The Stack v2 采用「Various (per-file)」自定义或混合许可证。在任何商业产品中使用前,请仔细阅读数据集卡片。
The Stack v2 有多少数据?需要全部使用吗?
The Stack v2 包含 900B Tokens。通常不需要全部:风格和格式微调只需几百到几千条样本——先加载切片(如 split="train[:1000]"),质量到达瓶颈时再扩大规模。
The Stack v2 最适合做什么?
Pretraining code models across 600+ programming languages。它属于数据集中心的「代码」板块,那里有替代和互补的数据集。