数据集:
Code Clippy 数据集包含来自 GitHub 的各种公共代码库,涵盖了 22 种编程语言和 23 种扩展名,总共解压后约占用 16 TB 的数据。该数据集是从 Google BigQuery 上的公共 GitHub 数据集中创建的。
由于数据集非常大,请使用像下面示例中所见的 数据库 库的流参数:
from datasets import load_dataset
ds = load_dataset("CodedotAI/code_clippy_github", streaming=True)
{
'code_text': " a = mc^2",
'repo_name': 'NotEinstein',
'file_path': 'root/users/einstein.py',
'language': 'Python',
'license': 'isc',
'size': 2
}
| Field | Type | Description |
|---|---|---|
| code_text | string | string of the source code contained in the code file |
| repo_name | string | name of the GitHub repository |
| file_path | string | path of the code file within the repository |
| language | string | programming language used in the file inferred by the file extension |
| license | string | license of GitHub repository |
| size | int | size of source file in bytes |
该数据集只提供了一个训练集。
该数据集包含 22 种编程语言和 23 种扩展名:
{
"C": [".c"],
"C#": [".cs"],
"C++": [".cpp"],
"CSS": [".css"],
"Dart" : [".dart"],
"GO": [".go"],
"HTML":[".html"],
"Java": [".java"],
"JavaScript": [".js"],
"Jupyter Notebooks (Python)": [".ipynb"],
"Kotlin" : [".kt"],
"Lisp" : [".lisp"],
"Matlab" : [".m"],
"PHP": [".php"],
"Perl": [".pl"],
"Python": [".py"],
"R" : [".r"],
"Ruby": [".rb"],
"Rust": [".rs"],
"SQL": [".sql"],
"Shell": [".sh"],
"Swift" : [".swift"],
"TypeScript": [".ts"],
}
每个示例还附带了相关存储库的许可证信息。总共有 15 种许可证:
[
'mit',
'apache-2.0',
'gpl-2.0',
'gpl-3.0',
'bsd-3-clause',
'bsd-2-clause',
'unlicense',
'apacheagpl-3.0',
'lgpl-3.0',
'cc0-1.0',
'epl-1.0',
'lgpl-2.1',
'mpl-2.0',
'isc',
'artistic-2.0'
]
该数据集约占用 ~ 18 TB 的解压后空间。我们目前正在对其进行处理和进一步过滤。
该数据集是通过以下两个步骤创建的:
SELECT
f.id, f.repo_name, f.path, content.copies, content.size, content.content, lic.license
FROM
`bigquery-public-data.github_repos.files` AS f
JOIN
`bigquery-public-data.github_repos.contents` as content
ON
f.id = content.id
JOIN
`bigquery-public-data.github_repos.licenses` AS lic
ON
f.repo_name = lic.repo_name
WHERE
NOT content.binary
AND (
(f.path LIKE '%.py') OR (f.path LIKE '%.java') OR (f.path LIKE '%.js')
OR (f.path LIKE '%.html') OR (f.path LIKE '%.lisp') OR (f.path LIKE '%.sh')
OR (f.path LIKE '%.r') OR (f.path LIKE '%.pl') OR (f.path LIKE '%.css')
OR (f.path LIKE '%.sql') OR (f.path LIKE '%.c') OR (f.path LIKE '%.cpp')
OR (f.path LIKE '%.ts') OR (f.path LIKE '%.cs') OR (f.path LIKE '%.go')
OR (f.path LIKE '%.rs') OR (f.path LIKE '%.swift') OR (f.path LIKE '%.php')
OR (f.path LIKE '%.dart') OR (f.path LIKE '%.kt') OR (f.path LIKE '%.m')
OR (f.path LIKE '%.rb') OR (f.path LIKE '%.ipynb')
)
-- make sure we dont go above 1 megabyte
AND (content.size BETWEEN 1024 AND 1000000)
由于此数据是从公共存储库中收集的,存在个人和敏感信息通过开发人员意外或有意上传其密钥、密码、API 密钥、电子邮件等的可能性。
OpenAI 的论文 "Evaluating Large Language Models Trained on Code" 对训练于代码的大型语言模型可能产生的影响进行了很好的讨论。因此,这里重点强调了论文中涉及此数据集和可能从中训练的模型的一些讨论内容,特别是涉及法律影响的部分。
感谢 Google 通过 TPU Research Cloud 慷慨地提供计算资源。我们还要感谢 Dr. Razvan Bunescu 和 The College of Computing and Informatics at UNC Charlotte 对此项目的慷慨捐助,特别是对 BigQuery 和 Google Cloud Storage 成本的资助。我们还要感谢 codeparrot team at Hugging face 公开共享其关于 github-code 的文件,我们在该数据集的自述文件中使用了这些信息。如果您想了解类似于此数据集的其他数据集,请查看 github-code!