遇见数据集

BGLab/FlowBench

收藏
Hugging Face2024-06-29 更新2024-06-29 收录
官方服务:

资源简介:

# Example: Downloading a Folder from Our Repository **License:** cc-by-nc-4.0 Below is an example of downloading a folder from our repository. ## Installation To run the example code, you need to install the following package: ```bash pip install huggingface_hub ``` ## Example Code The following script demonstrates how to download a directory from the Hugging Face Hub: ```python from huggingface_hub import HfApi, hf_hub_download import os import shutil REPO_ID = "BGLab/FlowBench" DIRECTORY = "LDC_NS_2D" # Initialize the Hugging Face API api = HfApi() # List files in the directory files_list = api.list_repo_files(repo_id=REPO_ID, repo_type="dataset") # Filter the files in the specified directory files_to_download = [f for f in files_list if f.startswith(DIRECTORY)] # Create local directory if it doesn't exist os.makedirs(DIRECTORY, exist_ok=True) # Download each file for file in files_to_download: file_path = hf_hub_download(repo_id=REPO_ID, filename=file, repo_type="dataset") # Copy the file to the local directory using shutil.copy2 shutil.copy2(file_path, os.path.join(DIRECTORY, os.path.basename(file_path))) print("Files downloaded successfully.") ```

提供机构:
BGLab
原始信息汇总

数据集概述

许可证

  • 许可证类型: cc-by-nc-4.0

安装

  • 依赖包:
    • huggingface_hub

示例代码

  • 仓库ID: BGLab/FlowBench
  • 目录: LDC_NS_2D
  • 功能:
    • 初始化Hugging Face API
    • 列出指定目录中的文件
    • 过滤并下载指定目录中的文件
    • 将下载的文件复制到本地目录
二维码
社区交流群
二维码
科研交流群
商业服务