five

bigcode/the-stack-metadata

收藏
Hugging Face2023-03-16 更新2024-03-04 收录
下载链接:
https://hf-mirror.com/datasets/bigcode/the-stack-metadata
下载链接
链接失效反馈
官方服务:
资源简介:
这是一个包含The Stack数据集中使用的存储库的附加信息的集合。它包含文件路径、检测到的许可证以及其他信息。数据集的主要任务是重建The Stack文件的存储库结构,并可用于计算统计数据和自定义过滤或聚合操作。

This is a collection of supplementary information for the repositories used in The Stack dataset. It includes file paths, detected licenses, and other relevant information. The core purpose of this dataset is to reconstruct the repository structure of files within The Stack, and it can be used for calculating statistical metrics as well as performing custom filtering or aggregation operations.
提供机构:
bigcode
原始信息汇总

数据集卡片 - The Stack Metadata

数据集描述

  • 创建者: 众包和专家生成
  • 语言: 编程语言
  • 许可证: 其他
  • 多语言性: 多语言
  • 数据集名称: The-Stack-Metadata
  • 大小类别: 未知
  • 源数据集: 无
  • 任务类别: 文本生成

变更日志

版本 描述
v1.1 这是元数据的第一个版本,适用于 The Stack v1.1
v1.2 元数据数据集匹配 The Stack v1.2

数据集摘要

这是一个为 The Stack 使用的仓库提供的额外信息集合。它包含文件路径、检测到的许可证以及其他一些仓库信息。

支持的任务和排行榜

主要任务是从 The Stack 的文件中重新创建仓库结构。此外,该集合可用于计算统计数据和自定义过滤或聚合操作。

数据集结构

数据字段

数据集按仓库分成944个桶。除了图像中的字段外,ri 包含 min_repo_event_datetime,这是自2015年1月1日以来仓库事件的最早日期和时间。

使用示例

恢复 numpy 仓库中的 Python 文件夹结构:

python import datasets from pathlib import Path from tqdm.auto import tqdm import pandas as pd

假设元数据克隆到本地文件夹 /data/hf_repos/the-stack-metadata

The Stack 克隆到本地文件夹 /data/hf_repos/the-stack-v1.1

目标文件夹在 /repo_workdir/numpy_restored

the_stack_meta_path = Path(/data/hf_repos/the-stack-metadata) the_stack_path = Path(/data/hf_repos/the-stack-v1.1) repo_dst_root = Path(/repo_workdir/numpy_restored) repo_name = numpy/numpy

获取包含 numpy 仓库信息的桶

meta_bucket_path = the_stack_meta_path / data/255_944

从仓库名称获取仓库ID

ri_id = pd.read_parquet( meta_bucket_path / ri.parquet ).query( fname == "{repo_name}" )[id].to_list()[0]

获取仓库文件信息

files_info = pd.read_parquet( meta_bucket_path / fi.parquet ).query( fri_id == {ri_id} and size != 0 and is_deleted == False )

将文件信息转换为按语言和文件hexsha分组的字典

files_info_dict = { k: v[[hexsha, path]].groupby(hexsha).apply(lambda x: list(x[path])).to_dict() for k, v in files_info.groupby(lang_ex) }

加载 The Stack 的 Python 部分

ds = datasets.load_dataset( str(the_stack_path/data/python), num_proc=10, ignore_verifications=True )

将 numpy 仓库中的 Python 文件内容保存到适当位置

def save_file_content(example, files_info_dict, repo_dst_root): if example[hexsha] in files_info_dict: for el in files_info_dict[example[hexsha]]: path = repo_dst_root / el path.parent.mkdir(parents=True, exist_ok=True) path.write_text(example[content]) ds.map( save_file_content, fn_kwargs={files_info_dict: files_info_dict[Python], repo_dst_root: repo_dst_root}, num_proc=10 )

搜集汇总
数据集介绍
main_image_url
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务