数据集下载方法与参数速查表
✨ 数据集下载方法与参数速查表
本文档汇总了两个重要数据集的下载方法,并详细解释了命令行和 Python 脚本中的关键参数。
1. FMA 数据集 (fma_full.zip) - 使用 aria2c 高速下载
🌐 数据集网址
直接下载链接:https://os.unil.cloud.switch.ch/fma/fma_full.zip
💻 下载命令
aria2c \
-d /your/local/directory \
-o fma_full.zip \
-x 16 \
-s 16 \
-k 1M \
--file-allocation=trunc \
--all-proxy=http://127.0.0.1:7890 \
https://os.unil.cloud.switch.ch/fma/fma_full.zip
⚙️ 参数解释
| 选项 | 作用 | 详细说明 |
|---|---|---|
| -d /your/local/directory | **指定保存目录** | 将下载文件保存在您指定的本地路径。 |
| -o fma_full.zip | **指定文件名** | 确保文件名为 fma_full.zip。 |
| -x 16 | **最大并发连接数** | 设置每个 URL 的最大连接数,这里为 **16**,用于最大化下载速度。 |
| -s 16 | **分段(分块)数量** | 将文件分成 **16** 块同时下载,实现多线程加速。 |
| -k 1M | **最小分块大小** | 设定分块的最小尺寸为 **1M**。 |
| --file-allocation=trunc | **文件预分配方式** | 立即分配文件所需空间,提高写入效率。 |
| --all-proxy=http://... | **设置代理** | 使用 http://127.0.0.1:7890 作为全局代理地址。 |
2. CLAP_freesound 数据集 - 使用 huggingface_hub 下载
🌐 数据集网址
Hugging Face Hub 仓库页面:https://huggingface.co/datasets/Meranti/CLAP_freesound/tree/main/freesound
🛠️ 准备工作:安装与代理设置
# 1. 安装 huggingface_hub 库
pip310 install -U huggingface_hub
# 2. 设置代理环境变量
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
注意: 代理环境变量必须在执行 Python 脚本的同一个 shell 环境中设置。
💻 Python 下载脚本
python310 << 'EOF'
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="Meranti/CLAP_freesound",
repo_type="dataset",
allow_patterns="freesound/**",
local_dir="/path/to/dataset/CLAP_freesound"
)
EOF
⚙️ snapshot_download 参数解释
| 参数 | 作用 | 详细说明 |
|---|---|---|
| repo_id | **仓库标识符** | 要下载的 Hugging Face 仓库 ID (Meranti/CLAP_freesound)。 |
| repo_type | **仓库类型** | 指定为 "dataset"(数据集)。 |
| allow_patterns | **文件匹配模式** | 仅下载符合 freesound/** 模式的文件(即 freesound 文件夹及其所有内容)。 |
| local_dir | **本地保存路径** | 数据集下载到本地的目标路径,如 /path/to/dataset/CLAP_freesound。 |

浙公网安备 33010602011771号