数据集:

mvasiliniuc/iva-swift-codeint

英文

IVA Swift GitHub代码数据集

数据集描述

这是从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

进行了以下数据收集步骤:

  • 在Google BigQuery Project中创建数据集和表。
  • 在Google Cloud Storage中创建桶。
  • 在Google BigQuery Project中创建查询。
  • 运行查询,并设置将结果输出到在第一步创建的数据集和表中。
  • 将生成的数据集导出到第2步中创建的桶中。导出格式为带有gzip压缩的JSON。
  • 这些步骤的结果如下:

    • 处理了2.7 TB数据,
    • 提取的行数/Swift文件数为464,215,
    • 总逻辑字节为1.46 GB。
    • 结果总共有7个json.gz文件,总计700 MB。

    使用的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

    许可信息

    • 这个开源数据集的许可证是:other。
    • 该数据集是从 GitHub using BigQuery 的开源存储库中收集的。
    • 在对应的许可证列中查找数据集中每个条目的许可证。

    引用信息

    @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 }
    }