admin commited on
Commit ·
cccd770
1
Parent(s): 70a944b
sync ms
Browse files- README.md +11 -17
- hoyoTTS.py +42 -27
README.md
CHANGED
|
@@ -4,24 +4,18 @@ viewer: false
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Genshin Impact & Honkai Star Rail Game Character Voice Dataset
|
| 7 |
-
This repository is the integration code for the
|
| 8 |
-
|
| 9 |
-
## Environment
|
| 10 |
-
```bash
|
| 11 |
-
pip install datasets py7zr librosa
|
| 12 |
-
```
|
| 13 |
|
| 14 |
## Supported characters
|
| 15 |
-
|
| 16 |
-
[Star Rail characters](https://pan.ai-hobbyist.com/StarRail%20Datasets/%E5%88%86%E8%A7%92%E8%89%B2%E5%8C%85/%E8%8B%B1%E8%AF%AD)
|
| 17 |
|
| 18 |
## Splits
|
| 19 |
| Language | Genshin Impact | Honkai Star Rail |
|
| 20 |
| :------: | :------------: | :--------------: |
|
| 21 |
-
| Chinese | `
|
| 22 |
-
| Japanese | `
|
| 23 |
-
| English | `
|
| 24 |
-
| Korean | `
|
| 25 |
|
| 26 |
## Usage
|
| 27 |
```python
|
|
@@ -30,7 +24,7 @@ from datasets import load_dataset
|
|
| 30 |
ds = load_dataset(
|
| 31 |
"Genius-Society/hoyoTTS",
|
| 32 |
name="黑塔", # The Chinese name of the character
|
| 33 |
-
split="
|
| 34 |
cache_dir="./__pycache__", # The cache location of the dataset
|
| 35 |
)
|
| 36 |
for item in ds:
|
|
@@ -46,7 +40,7 @@ cd hoyoTTS
|
|
| 46 |
## Mirror
|
| 47 |
<https://www.modelscope.cn/datasets/Genius-Society/hoyoTTS>
|
| 48 |
|
| 49 |
-
##
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Genshin Impact & Honkai Star Rail Game Character Voice Dataset
|
| 7 |
+
This repository is the integration code for the TTS datasets of miHoYo games provided by [AI Hobbyist](https://www.modelscope.cn/organization/aihobbyist), with the final right of interpretation belonging to [miHoYo](https://www.mihoyo.com). The integration code aims to provide a more convenient usage solution for the community: for `Python` developers, only a few lines of code are needed to automatically search, download, split by language, and normalize on demand, instead of manually searching for and downloading the cumbersome complete package to accommodate users with different backgrounds and thresholds. The integration code is provided by [Genius-Society](https://www.modelscope.cn/organization/Genius-Society). If you need to use the compressed package version of the data source and write your own data processing scripts, you can support the original author.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
## Supported characters
|
| 10 |
+
<https://res.acgnai.top>
|
|
|
|
| 11 |
|
| 12 |
## Splits
|
| 13 |
| Language | Genshin Impact | Honkai Star Rail |
|
| 14 |
| :------: | :------------: | :--------------: |
|
| 15 |
+
| Chinese | `Genshin_zh` | `StarRail_zh` |
|
| 16 |
+
| Japanese | `Genshin_ja` | `StarRail_ja` |
|
| 17 |
+
| English | `Genshin_en` | `StarRail_en` |
|
| 18 |
+
| Korean | `Genshin_ko` | `StarRail_ko` |
|
| 19 |
|
| 20 |
## Usage
|
| 21 |
```python
|
|
|
|
| 24 |
ds = load_dataset(
|
| 25 |
"Genius-Society/hoyoTTS",
|
| 26 |
name="黑塔", # The Chinese name of the character
|
| 27 |
+
split="StarRail_en", # The language options should match the character's game
|
| 28 |
cache_dir="./__pycache__", # The cache location of the dataset
|
| 29 |
)
|
| 30 |
for item in ds:
|
|
|
|
| 40 |
## Mirror
|
| 41 |
<https://www.modelscope.cn/datasets/Genius-Society/hoyoTTS>
|
| 42 |
|
| 43 |
+
## Thanks
|
| 44 |
+
- <https://pan.ai-hobbyist.com>
|
| 45 |
+
- <https://ys.mihoyo.com/main>
|
| 46 |
+
- <https://sr.mihoyo.com>
|
hoyoTTS.py
CHANGED
|
@@ -1,20 +1,13 @@
|
|
| 1 |
import os
|
| 2 |
import random
|
| 3 |
import datasets
|
| 4 |
-
import
|
| 5 |
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
"genshin_jp": "Genshin Datasets/日语",
|
| 11 |
-
"genshin_en": "Genshin Datasets/英语",
|
| 12 |
-
"genshin_kr": "Genshin Datasets/韩语",
|
| 13 |
-
"starail_zh": "StarRail Datasets/分角色包/中文",
|
| 14 |
-
"starail_jp": "StarRail Datasets/分角色包/日语",
|
| 15 |
-
"starail_en": "StarRail Datasets/分角色包/英语",
|
| 16 |
-
"starail_kr": "StarRail Datasets/分角色包/韩语",
|
| 17 |
-
}
|
| 18 |
|
| 19 |
|
| 20 |
class hoyoTTS(datasets.GeneratorBasedBuilder):
|
|
@@ -42,33 +35,55 @@ class hoyoTTS(datasets.GeneratorBasedBuilder):
|
|
| 42 |
|
| 43 |
return content.strip()
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
def _split_generators(self, dl_manager):
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
files = []
|
| 59 |
for fpath in dl_manager.iter_files([data_files]):
|
| 60 |
if os.path.basename(fpath).endswith(".wav"):
|
| 61 |
files.append({"audio": fpath, "text": self._get_txt(fpath)})
|
| 62 |
|
| 63 |
random.shuffle(files)
|
| 64 |
-
|
| 65 |
datasets.SplitGenerator(
|
| 66 |
-
name=
|
| 67 |
gen_kwargs={"files": files},
|
| 68 |
)
|
| 69 |
)
|
| 70 |
|
| 71 |
-
return
|
| 72 |
|
| 73 |
def _generate_examples(self, files):
|
| 74 |
for i, path in enumerate(files):
|
|
|
|
| 1 |
import os
|
| 2 |
import random
|
| 3 |
import datasets
|
| 4 |
+
import requests
|
| 5 |
|
| 6 |
+
_URL = "https://res.ai-lab.top/api/acgnailib/models"
|
| 7 |
|
| 8 |
+
_GAMES = {"Genshin": "原神", "StarRail": "星穹铁道"}
|
| 9 |
+
|
| 10 |
+
_LANGUAGES = {"zh": "中文", "ja": "日语", "en": "英语", "ko": "韩语"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
class hoyoTTS(datasets.GeneratorBasedBuilder):
|
|
|
|
| 35 |
|
| 36 |
return content.strip()
|
| 37 |
|
| 38 |
+
def _parse_url(self, game: str, lang: str):
|
| 39 |
+
response = requests.post(
|
| 40 |
+
_URL,
|
| 41 |
+
json={
|
| 42 |
+
"category": _GAMES[game],
|
| 43 |
+
"repo": f"datasets/aihobbyist/{game}_Dataset",
|
| 44 |
+
"root_path": "/datasets",
|
| 45 |
+
"subcategory": _LANGUAGES[lang],
|
| 46 |
+
},
|
| 47 |
+
headers={
|
| 48 |
+
"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"
|
| 49 |
+
},
|
| 50 |
+
)
|
| 51 |
+
response.raise_for_status()
|
| 52 |
+
data = response.json()
|
| 53 |
+
for item in data:
|
| 54 |
+
if item["dataname"] == self.config.name:
|
| 55 |
+
return item["dl_link"]
|
| 56 |
+
|
| 57 |
+
return None
|
| 58 |
+
|
| 59 |
def _split_generators(self, dl_manager):
|
| 60 |
+
data_splits = []
|
| 61 |
+
for game in _GAMES:
|
| 62 |
+
for lang in _LANGUAGES:
|
| 63 |
+
url = self._parse_url(game, lang)
|
| 64 |
+
if not url:
|
| 65 |
+
continue
|
| 66 |
+
|
| 67 |
+
try:
|
| 68 |
+
data_files = dl_manager.download_and_extract(url)
|
| 69 |
+
except Exception as e:
|
| 70 |
+
print(f"{e}, retrying...")
|
| 71 |
+
data_files = dl_manager.download_and_extract(url)
|
| 72 |
+
|
| 73 |
files = []
|
| 74 |
for fpath in dl_manager.iter_files([data_files]):
|
| 75 |
if os.path.basename(fpath).endswith(".wav"):
|
| 76 |
files.append({"audio": fpath, "text": self._get_txt(fpath)})
|
| 77 |
|
| 78 |
random.shuffle(files)
|
| 79 |
+
data_splits.append(
|
| 80 |
datasets.SplitGenerator(
|
| 81 |
+
name=f"{game}_{lang}",
|
| 82 |
gen_kwargs={"files": files},
|
| 83 |
)
|
| 84 |
)
|
| 85 |
|
| 86 |
+
return data_splits
|
| 87 |
|
| 88 |
def _generate_examples(self, files):
|
| 89 |
for i, path in enumerate(files):
|