admin
commited on
Commit
·
b6d3878
1
Parent(s):
f390b39
sync hoyo
Browse files
README.md
CHANGED
|
@@ -26,8 +26,9 @@ from datasets import load_dataset
|
|
| 26 |
ds = load_dataset(
|
| 27 |
"Genius-Society/wwTTS",
|
| 28 |
name="椿", # The Chinese name of the character
|
| 29 |
-
split="
|
| 30 |
cache_dir="./__pycache__", # The cache location of the dataset
|
|
|
|
| 31 |
)
|
| 32 |
for item in ds:
|
| 33 |
print(item)
|
|
|
|
| 26 |
ds = load_dataset(
|
| 27 |
"Genius-Society/wwTTS",
|
| 28 |
name="椿", # The Chinese name of the character
|
| 29 |
+
split="en", # Choose a language
|
| 30 |
cache_dir="./__pycache__", # The cache location of the dataset
|
| 31 |
+
trust_remote_code=True,
|
| 32 |
)
|
| 33 |
for item in ds:
|
| 34 |
print(item)
|
wwTTS.py
CHANGED
|
@@ -4,11 +4,11 @@ import random
|
|
| 4 |
import datasets
|
| 5 |
import requests
|
| 6 |
import subprocess
|
| 7 |
-
|
| 8 |
|
| 9 |
_URL = "https://res.ai-lab.top/api/acgnailib/models"
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
|
| 14 |
class wwTTS(datasets.GeneratorBasedBuilder):
|
|
@@ -36,7 +36,7 @@ class wwTTS(datasets.GeneratorBasedBuilder):
|
|
| 36 |
|
| 37 |
return content.strip()
|
| 38 |
|
| 39 |
-
def _parse_url(self, lang: str):
|
| 40 |
try:
|
| 41 |
response = requests.post(
|
| 42 |
_URL,
|
|
@@ -44,7 +44,7 @@ class wwTTS(datasets.GeneratorBasedBuilder):
|
|
| 44 |
"category": "鸣潮",
|
| 45 |
"repo": f"datasets/aihobbyist/WutheringWaves_Dataset",
|
| 46 |
"root_path": "/datasets",
|
| 47 |
-
"subcategory":
|
| 48 |
},
|
| 49 |
headers={
|
| 50 |
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
|
|
@@ -60,23 +60,25 @@ class wwTTS(datasets.GeneratorBasedBuilder):
|
|
| 60 |
|
| 61 |
except Exception as e:
|
| 62 |
print(f"{e}, retrying...")
|
| 63 |
-
time.sleep(
|
| 64 |
return self._parse_url(lang)
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
def _split_generators(self, dl_manager):
|
| 67 |
data_splits = []
|
| 68 |
subprocess.run(["pip", "install", "py7zr", "librosa"])
|
| 69 |
-
for lang in
|
| 70 |
url = self._parse_url(lang)
|
| 71 |
if not url:
|
| 72 |
continue
|
| 73 |
|
| 74 |
-
|
| 75 |
-
data_files = dl_manager.download_and_extract(url)
|
| 76 |
-
except Exception as e:
|
| 77 |
-
print(f"{e}, retrying...")
|
| 78 |
-
data_files = dl_manager.download_and_extract(url)
|
| 79 |
-
|
| 80 |
files = []
|
| 81 |
for fpath in dl_manager.iter_files([data_files]):
|
| 82 |
if os.path.basename(fpath).endswith(".wav"):
|
|
|
|
| 4 |
import datasets
|
| 5 |
import requests
|
| 6 |
import subprocess
|
| 7 |
+
from datasets import DownloadManager
|
| 8 |
|
| 9 |
_URL = "https://res.ai-lab.top/api/acgnailib/models"
|
| 10 |
|
| 11 |
+
_LANGS = {"zh": "中文", "jp": "日语", "en": "英语", "kr": "韩语"}
|
| 12 |
|
| 13 |
|
| 14 |
class wwTTS(datasets.GeneratorBasedBuilder):
|
|
|
|
| 36 |
|
| 37 |
return content.strip()
|
| 38 |
|
| 39 |
+
def _parse_url(self, lang: str, retry_delay=5):
|
| 40 |
try:
|
| 41 |
response = requests.post(
|
| 42 |
_URL,
|
|
|
|
| 44 |
"category": "鸣潮",
|
| 45 |
"repo": f"datasets/aihobbyist/WutheringWaves_Dataset",
|
| 46 |
"root_path": "/datasets",
|
| 47 |
+
"subcategory": _LANGS[lang],
|
| 48 |
},
|
| 49 |
headers={
|
| 50 |
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
|
|
|
|
| 60 |
|
| 61 |
except Exception as e:
|
| 62 |
print(f"{e}, retrying...")
|
| 63 |
+
time.sleep(retry_delay)
|
| 64 |
return self._parse_url(lang)
|
| 65 |
|
| 66 |
+
def _download_and_extract(self, dl_manager: DownloadManager, url: str):
|
| 67 |
+
try:
|
| 68 |
+
return dl_manager.download_and_extract(url)
|
| 69 |
+
except Exception as e:
|
| 70 |
+
print(f"{e}, retrying...")
|
| 71 |
+
return self._download_and_extract(dl_manager, url)
|
| 72 |
+
|
| 73 |
def _split_generators(self, dl_manager):
|
| 74 |
data_splits = []
|
| 75 |
subprocess.run(["pip", "install", "py7zr", "librosa"])
|
| 76 |
+
for lang in _LANGS:
|
| 77 |
url = self._parse_url(lang)
|
| 78 |
if not url:
|
| 79 |
continue
|
| 80 |
|
| 81 |
+
data_files = self._download_and_extract(dl_manager, url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
files = []
|
| 83 |
for fpath in dl_manager.iter_files([data_files]):
|
| 84 |
if os.path.basename(fpath).endswith(".wav"):
|