dlxj commited on
Commit
32e14ca
·
1 Parent(s): de360fb

LFS 大文件数据按需下载的方法

Browse files
Files changed (1) hide show
  1. readme.txt +42 -1
readme.txt CHANGED
@@ -7,7 +7,7 @@ see https://github.com/NVIDIA-NeMo/NeMo/blob/main/tutorials/asr/ASR_Example_Comm
7
 
8
  see https://github.com/GiantAILab/DiaMoE-TTS
9
  清华方言 TTS
10
-
11
 
12
  这个 KeyError 报错是由于 WebDataset 解析 tar 包中的路径与 NeMo 的 Manifest 映射字典键值不匹配 导致的。
13
 
@@ -104,6 +104,47 @@ conda run -n NeMo pip install datasets hydra-core omegaconf librosa soundfile
104
  # tar xzvf "/mnt/y/ai/Common Voice Scripted Speech 25.0 - Japanese.tar.gz" -C /mnt/e/huggingface_echodict/NeMo/data
105
  wsl 解压数据
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  python .\convert_ja.py
109
  转换 common_voice_11_0 中的 ja 数据
 
7
 
8
  see https://github.com/GiantAILab/DiaMoE-TTS
9
  清华方言 TTS
10
+
11
 
12
  这个 KeyError 报错是由于 WebDataset 解析 tar 包中的路径与 NeMo 的 Manifest 映射字典键值不匹配 导致的。
13
 
 
104
  # tar xzvf "/mnt/y/ai/Common Voice Scripted Speech 25.0 - Japanese.tar.gz" -C /mnt/e/huggingface_echodict/NeMo/data
105
  wsl 解压数据
106
 
107
+ 需要 clone 这个 git-lfs 项目 https://ai.gitee.com/hf-datasets/common_voice_11_0,
108
+ 但要排除 audio 文件夹 clone
109
+
110
+ # 1. 设置环境变量,在 clone 时跳过自动下载 LFS 实体文件
111
+ $env:GIT_LFS_SKIP_SMUDGE=1
112
+
113
+ # 2. 克隆项目(此时只会下载代码和 LFS 文件的“指针”,速度会很快)
114
+ git clone https://ai.gitee.com/hf-datasets/common_voice_11_0
115
+
116
+ # 3. 进入项目目录
117
+ cd common_voice_11_0
118
+
119
+ # 4. 配置 LFS 排除规则,告诉 LFS 不要拉取 audio 文件夹下的内容
120
+ git config lfs.fetchexclude "audio/**"
121
+
122
+ # 5. 拉取项目中除了 audio 文件夹之外的其他 LFS 文件(如果有的话)
123
+ git lfs pull
124
+
125
+ 现在需要拉 common_voice_11_0/audio/ja 这个文件夹,怎么做
126
+
127
+ 如果你现在只需要单独拉取 `audio/ja` 这个文件夹中的大文件,可以通过在 `git lfs pull` 时指定 `--include` 参数,并用 `--exclude=""` 临时覆盖掉之前设置的排除规则。
128
+
129
+ 请在终端中进入你的项目目录,然后执行以下命令:
130
+
131
+ ```powershell
132
+ # 1. 确保当前在项目目录下
133
+ cd common_voice_11_0
134
+
135
+ # 2. 仅拉取 audio/ja 目录下的 LFS 文件,并临时清空排除规则
136
+ git lfs pull --include="audio/ja/**" --exclude=""
137
+ ```
138
+
139
+ **命令原理解释:**
140
+ * `--include="audio/ja/**"`:告诉 Git LFS 本次只下载 `audio/ja` 及其所有子目录下的真实大文件。
141
+ * `--exclude=""`:因为我们在上一步中给这个仓库全局配置了忽略整个 `audio` 文件夹(`lfs.fetchexclude "audio/**"`),这里传入空的 exclude 参数可以**临时覆盖**那个配置,从而保证 `ja` 文件夹不会被错误拦截,顺利下载。
142
+
143
+ 执行完毕后,`audio/ja` 里的音频文件就会从 LFS 替换为实际的物理文件了,而 `audio` 目录下的其他语言文件夹依然保持为指针状态,不会占用你的磁盘空间。
144
+
145
+
146
+
147
+
148
 
149
  python .\convert_ja.py
150
  转换 common_voice_11_0 中的 ja 数据