Metadata-Version: 2.5
Name: hayakoe
Version: 1.4.0
Summary: HayaKoe — Fast ONNX-optimized Japanese TTS based on Style-Bert-VITS2
Project-URL: Source, https://github.com/LemonDouble/hayakoe
Author: LemonDouble
License-Expression: AGPL-3.0-only AND LGPL-3.0-only AND GPL-3.0-only
License-File: GPL_LICENSE
License-File: LGPL_LICENSE
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: huggingface-hub>=0.20
Requires-Dist: lemon-pyopenjtalk-prebuilt==0.0.10
Requires-Dist: loguru<0.8,>=0.7
Requires-Dist: num2words<0.6,>=0.5.12
Requires-Dist: numpy>=2.0
Requires-Dist: onnxruntime>=1.17
Requires-Dist: pydantic<3,>=2.7
Requires-Dist: pyworld-prebuilt==0.3.5.post2
Requires-Dist: transformers>=5.0
Provides-Extra: gpu
Requires-Dist: safetensors>=0.4; extra == 'gpu'
Provides-Extra: s3
Requires-Dist: boto3>=1.26; extra == 's3'
Description-Content-Type: text/markdown

**한국어** | **[日本語](./README.ja.md)** | **[简体中文](./README.zh-CN.md)** | **[繁體中文](./README.zh-TW.md)** | **[English](./README.en.md)**

# HayaKoe

[Style-Bert-VITS2](https://github.com/litagin02/Style-Bert-VITS2)를 기반으로 한 고속 일본어 TTS 라이브러리입니다.

**[문서 사이트](https://lemondouble.github.io/hayakoe/)** · **[음성 샘플 듣기](https://lemondouble.github.io/hayakoe/quickstart/#이런-음성을-마음껏-만들-수-있어요)** · **[깊이 읽기](https://lemondouble.github.io/hayakoe/deep-dive/)**

> 설치부터 파라미터 조절, 자체 화자 학습, 서버 배포, 아키텍처 상세까지 모든 내용은 **[문서 사이트](https://lemondouble.github.io/hayakoe/)** 에 정리해 두었습니다.

> Based on [Style-Bert-VITS2](https://github.com/litagin02/Style-Bert-VITS2) by litagin02 (AGPL-3.0)

## 특징

- **ONNX 최적화**: CPU 실시간 추론 (원본 Style-Bert-VITS2 대비 1.3~3.2 배 빠르고 RAM 82% 절감)
- **torch 불필요**: CPU 추론 시 PyTorch 없이 동작 (경량 설치)
- **간결한 API**: 체이닝 한 줄 `TTS().load(...).prepare()`
- **소스 플러그형**: HuggingFace / S3 / 로컬 경로를 섞어서 사용 가능
- **Thread-safe**: 싱글톤 서빙 (FastAPI 등)에서 동기/비동기 양쪽 지원
- **JP-Extra 모델**: Style-Bert-VITS2 JP-Extra, DeBERTa JP
- **영어→카타카나 자동 변환**: 22만 엔트리 외래어 사전 룩업 (의존성 없음)

## 설치

### CPU (기본, torch 불필요)

<details open>
<summary>pip</summary>

```bash
pip install hayakoe
```
</details>

<details>
<summary>uv</summary>

```bash
uv add hayakoe
```
</details>

<details>
<summary>Poetry</summary>

```bash
poetry add hayakoe
```
</details>

### GPU (PyTorch CUDA 별도 설치 필요)

<details open>
<summary>pip</summary>

```bash
pip install torch --index-url https://download.pytorch.org/whl/cu126
pip install hayakoe[gpu]
```
</details>

<details>
<summary>uv</summary>

```bash
uv add torch --index https://download.pytorch.org/whl/cu126
uv add hayakoe --extra gpu
```
</details>

<details>
<summary>Poetry</summary>

```bash
pip install torch --index-url https://download.pytorch.org/whl/cu126
poetry add hayakoe -E gpu
```
</details>

기본 모델은 [HuggingFace](https://huggingface.co/lemondouble/hayakoe)에서 자동으로 내려받습니다.

자체 학습한 화자는 private HF 레포 / S3 / 로컬 경로 중 어디에든 둘 수 있습니다.

## 사용법

```python
from hayakoe import TTS

tts = TTS().load("jvnv-F1-jp").prepare()
tts.speakers["jvnv-F1-jp"].generate("こんにちは").save("output.wav")
```

GPU에서 실행하려면 `TTS()`를 `TTS(device="cuda")`로 바꾸면 됩니다.

### 공식 화자

| 이름 | 설명 | 스타일 |
|------|------|--------|
| `jvnv-F1-jp` | 여성 화자 1 | Neutral, Happy, Sad, Angry, Fear, Surprise, Disgust |
| `jvnv-F2-jp` | 여성 화자 2 | 〃 |
| `jvnv-M1-jp` | 남성 화자 1 | 〃 |
| `jvnv-M2-jp` | 남성 화자 2 | 〃 |
| `tsukuyomi_chan` | つくよみちゃん — 애니메이션풍 | Neutral |
| `amitaro_normal` | あみたろ — 노멀 | Neutral |
| `amitaro_runrun` | あみたろ — 설렘 | Neutral |
| `amitaro_yofukashi` | あみたろ — 차분 | Neutral |
| `amitaro_punsuka` | あみたろ — 화남 | Neutral |
| `amitaro_sasayaki_a` | あみたろ — 속삭임A | Neutral |
| `amitaro_sasayaki_b` | あみたろ — 속삭임B | Neutral |

각 화자의 음성 샘플은 **[문서 사이트에서 직접 들어 볼 수 있습니다](https://lemondouble.github.io/hayakoe/quickstart/#이런-음성을-마음껏-만들-수-있어요)**.

## 더 알아보기

- [첫 음성 만들기](https://lemondouble.github.io/hayakoe/quickstart/first-voice): 여러 문장, bytes로 받기, 여러 화자 올리기
- [속도·운율 조절](https://lemondouble.github.io/hayakoe/quickstart/parameters): 말속도, 피치, 억양, 스타일, phoneme 타이밍
- [커스텀 단어 등록](https://lemondouble.github.io/hayakoe/quickstart/custom-words): pyopenjtalk가 모르는 고유명사의 읽기와 악센트
- [문장 단위 스트리밍](https://lemondouble.github.io/hayakoe/quickstart/streaming): 첫 문장부터 바로 재생
- [서버로 배포](https://lemondouble.github.io/hayakoe/deploy/): FastAPI 싱글톤 서빙, Docker 빌드 시점 다운로드
- [FAQ](https://lemondouble.github.io/hayakoe/faq/): 캐시 경로, private HuggingFace · S3 소스, 내부 로그 보기
- [자체 화자 학습](https://lemondouble.github.io/hayakoe/training/): 데이터 준비부터 학습, 품질 리포트, 배포까지
- [깊이 읽기](https://lemondouble.github.io/hayakoe/deep-dive/): 아키텍처와 최적화 기법

## 라이선스

- 코드: AGPL-3.0 (원본 Style-Bert-VITS2)
- 유저 사전 모듈 (`user_dict`): LGPL-3.0 ([VOICEVOX ENGINE](https://github.com/VOICEVOX/voicevox_engine) 유래)
- JVNV 음성 모델: CC BY-SA 4.0 ([JVNV Corpus](https://sites.google.com/site/shinnosuketakamichi/research-topics/jvnv_corpus))
- 사전학습 모델 (DeBERTa): CC BY-SA 4.0 ([ku-nlp/deberta-v2-large-japanese-char-wwm](https://huggingface.co/ku-nlp/deberta-v2-large-japanese-char-wwm))
- 영어→카타카나 사전 데이터: GPL-3.0 ([loanwords_gairaigo](https://github.com/jamesohortle/loanwords_gairaigo))

라이선스 전문은 [LICENSE](./LICENSE) · [LGPL_LICENSE](./LGPL_LICENSE) · [GPL_LICENSE](./GPL_LICENSE) 파일에 있으며, 배포 패키지(wheel)의 `hayakoe-*.dist-info/licenses/`에도 동봉됩니다.

## Credits

- [Style-Bert-VITS2](https://github.com/litagin02/Style-Bert-VITS2) by litagin02
- [Bert-VITS2](https://github.com/fishaudio/Bert-VITS2) by Fish Audio
- [JVNV Corpus](https://sites.google.com/site/shinnosuketakamichi/research-topics/jvnv_corpus): 일본어 감정 음성 코퍼스
- [loanwords_gairaigo](https://github.com/jamesohortle/loanwords_gairaigo) by James O'Hortle: 영어→카타카나 사전 데이터
