Fix: handling esd.list processing error

This commit is contained in:
litagin02
2024-02-25 18:33:47 +09:00
parent 8d7d7c3265
commit 9d6a1db0e9
2 changed files with 17 additions and 7 deletions

View File

@@ -12,11 +12,13 @@
以下では次のような方針でやっています。
- `/storage/`は永続ストレージなので、事前学習モデルとかを含めてリポジトリをクローンするとよい。
- `/notebooks/`一時ストレージなので、データセットやその結果を保存する
- `/notebooks/`ノートブックごとに変わるストレージなので(同一ノートブック違うランタイムだと共有されるらしい)、データセットやその結果を保存する。ただ容量が多い場合はあふれる可能性があるので`/tmp/`に保存するとよいかもしれない
- hugging faceアカウントを作り、プライベートなリポジトリを作って、学習元データを置いたり、学習結果を随時アップロードする。
### 1. 環境を作る
以下はデフォルトの`Start from Scratch`で作成した環境の場合。[Dockerfile.train](../Dockerfile.train)を使ったカスタムイメージをするとPythonの環境構築の手間がちょっと省けるので、それを使いたい人は`Advanced Options / Container / Name`に[`litagin/mygradient:latest`](https://hub.docker.com/r/litagin/mygradient/tags)を指定すると使えますpipの箇所が不要になる等
まずは永続ストレージにgit clone
```bash
mkdir -p /storage/sbv2

View File

@@ -9,6 +9,7 @@ import time
import webbrowser
from datetime import datetime
from multiprocessing import cpu_count
from pathlib import Path
import gradio as gr
import yaml
@@ -162,13 +163,20 @@ def preprocess_text(model_name, use_jp_extra, val_per_lang):
except FileNotFoundError:
logger.error(f"Step 3: {lbl_path} not found.")
return False, f"Step 3, Error: 書き起こしファイル {lbl_path} が見つかりません。"
with open(lbl_path, "w", encoding="utf-8") as f:
new_lines = []
for line in lines:
path, spk, language, text = line.strip().split("|")
path = os.path.join(dataset_path, "wavs", os.path.basename(path)).replace(
"\\", "/"
if len(line.strip().split("|")) != 4:
logger.error(f"Step 3: {lbl_path} has invalid format at line:\n{line}")
return (
False,
f"Step 3, Error: 書き起こしファイル次の行の形式が不正です:\n{line}",
)
f.writelines(f"{path}|{spk}|{language}|{text}\n")
path, spk, language, text = line.strip().split("|")
# pathをファイル名だけ取り出して正しいパスに変更
path = Path(dataset_path) / "wavs" / Path(path).name
new_lines.append(f"{path}|{spk}|{language}|{text}\n")
with open(lbl_path, "w", encoding="utf-8") as f:
f.writelines(new_lines)
cmd = [
"preprocess_text.py",
"--config-path",