数据集:
这是从GitHub提取的原始IVA Swift数据集。它包含了未经筛选的Swift文件,目的是用于训练代码生成模型。
该数据集包含来自GitHub的753,693个Swift代码文件,总共约700MB的数据。该数据集是从Google BigQuery上的公共GitHub数据集中创建的。
要下载完整的数据集:
from datasets import load_dataset
dataset = load_dataset('mvasiliniuc/iva-swift-codeint', split='train')
from datasets import load_dataset
dataset = load_dataset('mvasiliniuc/iva-swift-codeint', split='train')
print(dataset[77723])
#OUTPUT:
{
"repo_name":"simpleandpretty/decider-ios",
"path":"MessagesExtension/MediaResources.swift",
"copies":"1",
"size":"1232",
"content":"import Foundation\nimport UIKit\n\nclass MediaResources {\n\n static func mediaURL(forGameOption option:FightMove) -> URL {\n let bundle = Bundle.main\n guard\n let mediaURL = bundle.url(forResource: option.rawValue, withExtension: \"mp4\")\n ...",
"license":"gpl-3.0"
}
| Field | Type | Description |
|---|---|---|
| repo_name | string | name of the GitHub repository |
| path | string | path of the file in GitHub repository |
| copies | string | number of occurrences in dataset |
| code | string | content of source file |
| size | string | size of the source file in bytes |
| license | string | license of GitHub repository |
{
"repo_name":"simpleandpretty/decider-ios",
"path":"MessagesExtension/MediaResources.swift",
"copies":"1",
"size":"1232",
"content":"import Foundation\nimport UIKit\n\nclass MediaResources {\n\n static func mediaURL(forGameOption option:FightMove) -> URL {\n let bundle = Bundle.main\n guard\n let mediaURL = bundle.url(forResource: option.rawValue, withExtension: \"mp4\")\n ...",
"license":"gpl-3.0"
}
数据集仅包含Swift文件。
{
"Swift": [".swift"]
}
数据集中的每个条目都包含相关的许可证。以下是涉及的许可证及其出现次数的列表。
{
"agpl-3.0": 2775,
"apache-2.0": 180178,
"artistic-2.0": 314,
"bsd-2-clause": 5342,
"bsd-3-clause": 11429,
"cc0-1.0": 2718,
"epl-1.0": 980,
"gpl-2.0": 15751,
"gpl-3.0": 33074,
"isc": 1647,
"lgpl-2.1": 1741,
"lgpl-3.0": 6150,
"mit": 476518,
"mpl-2.0": 11799,
"unlicense": 3277
}
{
"Total size": "~712 MB",
"Number of files": 753693,
"Number of files under 500 bytes": 129827,
"Average file size in bytes": 4245,
}
使用Google Query for Github创建了该数据集: https://cloud.google.com/blog/topics/public-datasets/github-on-bigquery-analyze-all-the-open-source-code
进行了以下数据收集步骤:
这些步骤的结果如下:
使用的SQL查询是:
SELECT f.repo_name, f.path, c.copies, c.size, c.content, l.license FROM (select f.*, row_number() over (partition by id order by path desc) as seqnum from `bigquery-public-data.github_repos.files` AS f) f JOIN `bigquery-public-data.github_repos.contents` AS c ON f.id = c.id AND seqnum=1 JOIN `bigquery-public-data.github_repos.licenses` AS l ON f.repo_name = l.repo_name WHERE NOT c.binary AND ((f.path LIKE '%.swift') AND (c.size BETWEEN 0 AND 1048575))
数据集只包含训练拆分。
使用该数据集的筛选版本,进行了多个存储库的拆分:
该数据集包含来自各个存储库的源代码,可能包含有害或有偏见的代码,以及包含密码或用户名等敏感信息。
mircea.dev@icloud.com
@misc {mircea_vasiliniuc_2023,
author = { {Mircea Vasiliniuc} },
title = { iva-swift-codeint (Revision c09ebf8) },
year = 2023,
url = { https://huggingface.co/datasets/mvasiliniuc/iva-swift-codeint },
doi = { 10.57967/hf/0778 },
publisher = { Hugging Face }
}