From 8f481e64d826720cda189d595dc2723707246d4e Mon Sep 17 00:00:00 2001 From: Pengoose Date: Wed, 30 Oct 2024 23:12:39 +0900 Subject: [PATCH] feat: Added KR pages & Documentations (#607) * chore: sync upstream * feat: add ko pages * feat: add i18n(ko_KR.json) * docs: update finetune.md * docs: update inference.md * docs: update README.ko.md * docs: update index.md * docs: update inference.md * docs: update README.ko.md --- README.md | 2 +- docs/README.ja.md | 2 +- docs/README.ko.md | 111 +++++++++++++++ docs/README.pt-BR.md | 2 +- docs/README.zh.md | 2 +- docs/ko/finetune.md | 128 +++++++++++++++++ docs/ko/index.md | 215 +++++++++++++++++++++++++++++ docs/ko/inference.md | 134 ++++++++++++++++++ docs/ko/samples.md | 137 ++++++++++++++++++ fish_speech/i18n/locale/ko_KR.json | 123 +++++++++++++++++ 10 files changed, 852 insertions(+), 4 deletions(-) create mode 100644 docs/README.ko.md create mode 100644 docs/ko/finetune.md create mode 100644 docs/ko/index.md create mode 100644 docs/ko/inference.md create mode 100644 docs/ko/samples.md create mode 100644 fish_speech/i18n/locale/ko_KR.json diff --git a/README.md b/README.md index 301c7ea8..12e4522e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Fish Speech

-**English** | [简体中文](docs/README.zh.md) | [Portuguese](docs/README.pt-BR.md) | [日本語](docs/README.ja.md)
+**English** | [简体中文](docs/README.zh.md) | [Portuguese](docs/README.pt-BR.md) | [日本語](docs/README.ja.md) | [한국어](docs/README.ko.md)
Fish Speech 1.4 - Open-Source Multilingual Text-to-Speech with Voice Cloning | Product Hunt diff --git a/docs/README.ja.md b/docs/README.ja.md index 7bf18d9a..e0872e98 100644 --- a/docs/README.ja.md +++ b/docs/README.ja.md @@ -1,7 +1,7 @@

Fish Speech

-[English](../README.md) | [简体中文](README.zh.md) | [Portuguese](README.pt-BR.md) | **日本語**
+[English](../README.md) | [简体中文](README.zh.md) | [Portuguese](README.pt-BR.md) | **日本語** | [한국어](README.ko.md)
Fish Speech 1.4 - Open-Source Multilingual Text-to-Speech with Voice Cloning | Product Hunt diff --git a/docs/README.ko.md b/docs/README.ko.md new file mode 100644 index 00000000..952ae5f2 --- /dev/null +++ b/docs/README.ko.md @@ -0,0 +1,111 @@ +
+

Fish Speech

+ +[English](../README.md) | [简体中文](README.zh.md) | [Portuguese](README.pt-BR.md) | [日本語](README.ja.md) | **한국어**
+ +
+ Fish Speech 1.4 - Open-Source Multilingual Text-to-Speech with Voice Cloning | Product Hunt + + + fishaudio%2Ffish-speech | Trendshift + +
+
+
+ +
+
+
+
+ +
+ + Discord + + + Docker + + + Huggingface + +
+ +이 코드베이스와 모든 모델은 CC-BY-NC-SA-4.0 라이선스에 따라 배포됩니다. 자세한 내용은 [LICENSE](LICENSE)를 참조하시길 바랍니다. + +--- + +## 기능 + +1. **Zero-shot & Few-shot TTS:** 10초에서 30초의 음성 샘플을 입력하여 고품질의 TTS 출력을 생성합니다. **자세한 가이드는 [모범 사례](https://docs.fish.audio/text-to-speech/voice-clone-best-practices)를 참조하시길 바랍니다.** + +2. **다국어 및 교차 언어 지원:** 다국어 걱정 없이, 텍스트를 입력창에 복사하여 붙여넣기만 하면 됩니다. 현재 영어, 일본어, 한국어, 중국어, 프랑스어, 독일어, 아랍어, 스페인어를 지원합니다. + +3. **음소 의존성 제거:** 이 모델은 강력한 일반화 능력을 가지고 있으며, TTS가 음소에 의존하지 않습니다. 모든 언어 스크립트 텍스트를 손쉽게 처리할 수 있습니다. + +4. **높은 정확도:** 영어 텍스트 기준 5분 기준에서 단, 2%의 문자 오류율(CER)과 단어 오류율(WER)을 달성합니다. + +5. **빠른 속도:** fish-tech 가속을 통해 실시간 인자(RTF)는 Nvidia RTX 4060 노트북에서는 약 1:5, Nvidia RTX 4090에서는 1:15입니다. + +6. **웹 UI 추론:** Chrome, Firefox, Edge 등 다양한 브라우저에서 호환되는 Gradio 기반의 사용하기 쉬운 웹 UI를 제공합니다. + +7. **GUI 추론:** PyQt6 그래픽 인터페이스를 제공하여 API 서버와 원활하게 작동합니다. Linux, Windows 및 macOS를 지원합니다. [GUI 참조](https://github.com/AnyaCoder/fish-speech-gui). + +8. **배포 친화적:** Linux, Windows, macOS에서 네이티브로 지원되는 추론 서버를 쉽게 설정할 수 있어 속도 손실을 최소화합니다. + +## 면책 조항 + +이 코드베이스의 불법적 사용에 대해 어떠한 책임도 지지 않습니다. DMCA 및 관련 법률에 대한 로컬 법률을 참조하십시오. + +## 온라인 데모 + +[Fish Audio](https://fish.audio) + +## 로컬 추론을 위한 빠른 시작 + +[inference.ipynb](/inference.ipynb) + +## 영상 + +#### V1.4 데모 영상: [Youtube](https://www.youtube.com/watch?v=Ghc8cJdQyKQ) + +## 문서 + +- [English](https://speech.fish.audio/) +- [中文](https://speech.fish.audio/zh/) +- [日本語](https://speech.fish.audio/ja/) +- [Portuguese (Brazil)](https://speech.fish.audio/pt/) +- [한국어](https://speech.fish.audio/ko/) + +## Samples (2024/10/02 V1.4) + +- [English](https://speech.fish.audio/samples/) +- [中文](https://speech.fish.audio/zh/samples/) +- [日本語](https://speech.fish.audio/ja/samples/) +- [Portuguese (Brazil)](https://speech.fish.audio/pt/samples/) +- [한국어](https://speech.fish.audio/ko/samples/) + +## Credits + +- [VITS2 (daniilrobnikov)](https://github.com/daniilrobnikov/vits2) +- [Bert-VITS2](https://github.com/fishaudio/Bert-VITS2) +- [GPT VITS](https://github.com/innnky/gpt-vits) +- [MQTTS](https://github.com/b04901014/MQTTS) +- [GPT Fast](https://github.com/pytorch-labs/gpt-fast) +- [GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS) + +## Sponsor + +
+ + 6Block Avatar + +
+ 데이터 처리 후원: 6Block +
+
+ + Lepton Avatar + +
+ Fish Audio는 Lepton.AI에서 제공됩니다 +
diff --git a/docs/README.pt-BR.md b/docs/README.pt-BR.md index fbf20010..443617ce 100644 --- a/docs/README.pt-BR.md +++ b/docs/README.pt-BR.md @@ -1,7 +1,7 @@

Fish Speech

-[English](../README.md) | [简体中文](README.zh.md) | **Portuguese** | [日本語](README.ja.md)
+[English](../README.md) | [简体中文](README.zh.md) | **Portuguese** | [日本語](README.ja.md) | [한국어](README.ko.md)
Fish Speech 1.4 - Open-Source Multilingual Text-to-Speech with Voice Cloning | Product Hunt diff --git a/docs/README.zh.md b/docs/README.zh.md index be37e2e5..ee09a642 100644 --- a/docs/README.zh.md +++ b/docs/README.zh.md @@ -1,7 +1,7 @@

Fish Speech

-[English](../README.md) | **简体中文** | [Portuguese](README.pt-BR.md) | [日本語](README.ja.md)
+[English](../README.md) | **简体中文** | [Portuguese](README.pt-BR.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
Fish Speech 1.4 - Open-Source Multilingual Text-to-Speech with Voice Cloning | Product Hunt diff --git a/docs/ko/finetune.md b/docs/ko/finetune.md new file mode 100644 index 00000000..a13d5e51 --- /dev/null +++ b/docs/ko/finetune.md @@ -0,0 +1,128 @@ +# 파인튜닝 + +이 페이지를 열었다는 것은, 사전 학습된 퓨샷(Few-shot) 모델의 성능에 만족하지 못했다는 의미일 것입니다. 데이터셋의 성능을 향상시키기 위해 모델을 파인튜닝하고 싶으시겠죠. + +현재 버전에서는 'LLAMA' 부분만 파인튜닝하시면 됩니다. + +## LLAMA 파인튜닝 +### 1. 데이터셋 준비 + +``` +. +├── SPK1 +│ ├── 21.15-26.44.lab +│ ├── 21.15-26.44.mp3 +│ ├── 27.51-29.98.lab +│ ├── 27.51-29.98.mp3 +│ ├── 30.1-32.71.lab +│ └── 30.1-32.71.mp3 +└── SPK2 + ├── 38.79-40.85.lab + └── 38.79-40.85.mp3 +``` + +위와 같은 형식으로 데이터셋을 변환하여 `data` 디렉토리 안에 배치하세요. 오디오 파일의 확장자는 `.mp3`, `.wav`, `.flac` 중 하나여야 하며, 주석 파일은 `.lab` 확장자를 사용해야 합니다. + +!!! info "데이터셋 형식" + `.lab` 주석 파일은 오디오의 전사 내용만 포함하면 되며, 특별한 형식이 필요하지 않습니다. 예를 들어, `hi.mp3`에서 "Hello, goodbye"라는 대사를 말한다면, `hi.lab` 파일에는 "Hello, goodbye"라는 한 줄의 텍스트만 있어야 합니다. + +!!! warning + 데이터셋에 대한 음량 정규화(loudness normalization)를 적용하는 것이 좋습니다. 이를 위해 [fish-audio-preprocess](https://github.com/fishaudio/audio-preprocess)를 사용할 수 있습니다. + + ```bash + fap loudness-norm data-raw data --clean + ``` + +### 2. 시맨틱 토큰 배치 추출 + +VQGAN 가중치를 다운로드했는지 확인하세요. 다운로드하지 않았다면 아래 명령어를 실행하세요: + +```bash +huggingface-cli download fishaudio/fish-speech-1.4 --local-dir checkpoints/fish-speech-1.4 +``` + +이후 시맨틱 토큰을 추출하기 위해 아래 명령어를 실행하세요: + +```bash +python tools/vqgan/extract_vq.py data \ + --num-workers 1 --batch-size 16 \ + --config-name "firefly_gan_vq" \ + --checkpoint-path "checkpoints/fish-speech-1.4/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" +``` + +!!! note + 추출 속도를 높이기 위해 `--num-workers`와 `--batch-size` 값을 조정할 수 있지만, GPU 메모리 한도를 초과하지 않도록 주의하세요. + VITS 형식의 경우, `--filelist xxx.list`를 사용하여 파일 목록을 지정할 수 있습니다. + +이 명령을 실행하면 `data` 디렉토리 안에 `.npy` 파일이 생성됩니다. 다음과 같이 표시됩니다: + +``` +. +├── SPK1 +│ ├── 21.15-26.44.lab +│ ├── 21.15-26.44.mp3 +│ ├── 21.15-26.44.npy +│ ├── 27.51-29.98.lab +│ ├── 27.51-29.98.mp3 +│ ├── 27.51-29.98.npy +│ ├── 30.1-32.71.lab +│ ├── 30.1-32.71.mp3 +│ └── 30.1-32.71.npy +└── SPK2 + ├── 38.79-40.85.lab + ├── 38.79-40.85.mp3 + └── 38.79-40.85.npy +``` + +### 3. 데이터셋을 protobuf로 패킹 + +```bash +python tools/llama/build_dataset.py \ + --input "data" \ + --output "data/protos" \ + --text-extension .lab \ + --num-workers 16 +``` + +명령이 완료되면 `data` 디렉토리 안에 `quantized-dataset-ft.protos` 파일이 생성됩니다. + +### 4. 마지막으로, LoRA를 이용한 파인튜닝 + +마찬가지로, `LLAMA` 가중치를 다운로드했는지 확인하세요. 다운로드하지 않았다면 아래 명령어를 실행하세요: + +```bash +huggingface-cli download fishaudio/fish-speech-1.4 --local-dir checkpoints/fish-speech-1.4 +``` + +마지막으로, 아래 명령어를 실행하여 파인튜닝을 시작할 수 있습니다: + +```bash +python fish_speech/train.py --config-name text2semantic_finetune \ + project=$project \ + +lora@model.model.lora_config=r_8_alpha_16 +``` + +!!! note + `batch_size`, `gradient_accumulation_steps` 등의 학습 매개변수를 GPU 메모리에 맞게 조정하려면 `fish_speech/configs/text2semantic_finetune.yaml` 파일을 수정할 수 있습니다. + +!!! note + Windows 사용자의 경우, `nccl` 문제를 피하려면 `trainer.strategy.process_group_backend=gloo`를 사용할 수 있습니다. + +훈련이 완료되면 [추론](inference.md) 섹션을 참고하여 음성을 생성할 수 있습니다. + +!!! info + 기본적으로 모델은 화자의 말하는 패턴만 학습하고 음색은 학습하지 않습니다. 음색의 안정성을 위해 프롬프트를 사용해야 합니다. + 음색을 학습하려면 훈련 단계를 늘릴 수 있지만, 이는 과적합의 위험을 초래할 수 있습니다. + +훈련이 끝나면 LoRA 가중치를 일반 가중치로 변환한 후에 추론을 수행해야 합니다. + +```bash +python tools/llama/merge_lora.py \ + --lora-config r_8_alpha_16 \ + --base-weight checkpoints/fish-speech-1.4 \ + --lora-weight results/$project/checkpoints/step_000000010.ckpt \ + --output checkpoints/fish-speech-1.4-yth-lora/ +``` + +!!! note + 다른 체크포인트도 시도해 볼 수 있습니다. 요구 사항에 맞는 가장 초기 체크포인트를 사용하는 것이 좋습니다. 이들은 종종 분포 밖(OOD) 데이터에서 더 좋은 성능을 발휘합니다. diff --git a/docs/ko/index.md b/docs/ko/index.md new file mode 100644 index 00000000..86fb6088 --- /dev/null +++ b/docs/ko/index.md @@ -0,0 +1,215 @@ +# Introduction + + + +!!! warning + 이 코드베이스의 불법적인 사용에 대해서는 책임을 지지 않습니다. DMCA(Digital Millennium Copyright Act) 및 해당 지역의 관련 법률을 참조하십시오.
+ 이 코드베이스와 모든 모델은 CC-BY-NC-SA-4.0 라이선스에 따라 배포됩니다. + +

+ +

+ +## 요구 사항 + +- GPU 메모리: 4GB (추론용), 8GB (파인튜닝용) +- 시스템: Linux, Windows + +## Windows 설정 + +고급 Windows 사용자는 WSL2 또는 Docker를 사용하여 코드베이스를 실행하는 것을 고려할 수 있습니다. + +```bash +# 파이썬 3.10 가상 환경 생성, virtualenv도 사용할 수 있습니다. +conda create -n fish-speech python=3.10 +conda activate fish-speech + +# pytorch 설치 +pip3 install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu121 + +# fish-speech 설치 +pip3 install -e . + +# (가속 활성화) triton-windows 설치 +pip install https://github.com/AnyaCoder/fish-speech/releases/download/v0.1.0/triton_windows-0.1.0-py3-none-any.whl +``` + +비전문 Windows 사용자는 Linux 환경 없이 프로젝트를 실행할 수 있는 다음 기본 방법을 고려할 수 있습니다 (모델 컴파일 기능 포함, 즉 `torch.compile`): + +1. 프로젝트 패키지 추출. +2. `install_env.bat`을 클릭하여 환경 설치. +3. 컴파일 가속을 활성화하려면 아래 단계를 따르세요: + 1. LLVM 컴파일러 다운로드: + - [LLVM-17.0.6 (공식 사이트)](https://huggingface.co/fishaudio/fish-speech-1/resolve/main/LLVM-17.0.6-win64.exe?download=true) + - [LLVM-17.0.6 (미러 사이트)](https://hf-mirror.com/fishaudio/fish-speech-1/resolve/main/LLVM-17.0.6-win64.exe?download=true) + - `LLVM-17.0.6-win64.exe`를 다운로드 후 더블클릭하여 설치하고, 설치 경로 선택 시 `Add Path to Current User` 옵션을 체크하여 환경 변수를 추가합니다. + - 설치가 완료되었는지 확인합니다. + 2. Microsoft Visual C++ 재배포 가능 패키지를 다운로드하여 .dll 누락 문제 해결: + - [MSVC++ 14.40.33810.0 다운로드](https://aka.ms/vs/17/release/vc_redist.x64.exe) + 3. Visual Studio Community Edition을 다운로드하여 LLVM의 헤더 파일 의존성을 해결: + - [Visual Studio 다운로드](https://visualstudio.microsoft.com/zh-hans/downloads/) + - Visual Studio Installer를 설치한 후 Visual Studio Community 2022를 다운로드. + - `Desktop development with C++` 옵션을 선택하여 설치. + 4. [CUDA Toolkit 12.x](https://developer.nvidia.com/cuda-12-1-0-download-archive?target_os=Windows&target_arch=x86_64) 다운로드 및 설치. +4. `start.bat`을 더블 클릭하여 훈련 추론 WebUI 관리 인터페이스를 엽니다. 필요한 경우 아래 지침에 따라 `API_FLAGS`를 수정할 수 있습니다. + +!!! info "Optional" + + 추론을 위해 WebUI를 사용하고자 하시나요? + + 프로젝트 루트 디렉토리의 `API_FLAGS.txt` 파일을 편집하고 첫 세 줄을 아래와 같이 수정하세요: + ``` + --infer + # --api + # --listen ... + ... + ``` + +!!! info "Optional" + + API 서버를 시작하고 싶으신가요? + + 프로젝트 루트 디렉토리의 `API_FLAGS.txt` 파일을 편집하고 첫 세 줄을 아래와 같이 수정하세요: + + ``` + # --infer + --api + --listen ... + ... + ``` + +!!! info "Optional" + + `run_cmd.bat`을 더블 클릭하여 이 프로젝트의 conda/python 명령줄 환경에 진입할 수 있습니다. + +## Linux 설정 + +[pyproject.toml](../../pyproject.toml)에서 자세한 내용을 확인하세요. +```bash +# 파이썬 3.10 가상 환경 생성, virtualenv도 사용할 수 있습니다. +conda create -n fish-speech python=3.10 +conda activate fish-speech + +# (Ubuntu / Debian 사용자) sox + ffmpeg 설치 +apt install libsox-dev ffmpeg + +# (Ubuntu / Debian 사용자) pyaudio 설치 +apt install build-essential \ + cmake \ + libasound-dev \ + portaudio19-dev \ + libportaudio2 \ + libportaudiocpp0 + +# pytorch 설치 +pip3 install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 + +# fish-speech 설치 +pip3 install -e .[stable] +``` + +## macos 설정 + +MPS에서 추론을 수행하려면 `--device mps` 플래그를 추가하세요. +추론 속도 비교는 [이 PR](https://github.com/fishaudio/fish-speech/pull/461#issuecomment-2284277772)을 참조하십시오. + +!!! warning + Apple Silicon 장치에서는 `compile` 옵션이 공식적으로 지원되지 않으므로 추론 속도가 향상된다는 보장은 없습니다. + +```bash +# 파이썬 3.10 가상 환경 생성, virtualenv도 사용할 수 있습니다. +conda create -n fish-speech python=3.10 +conda activate fish-speech +# pytorch 설치 +pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 +# fish-speech 설치 +pip install -e .[stable] +``` + +## Docker 설정 + +1. NVIDIA Container Toolkit 설치: + + Docker에서 모델 훈련 및 추론에 GPU를 사용하려면 NVIDIA Container Toolkit을 설치해야 합니다: + + Ubuntu 사용자: + + ```bash + # 저장소 추가 + curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ + && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ + sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ + sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list + # nvidia-container-toolkit 설치 + sudo apt-get update + sudo apt-get install -y nvidia-container-toolkit + # Docker 서비스 재시작 + sudo systemctl restart docker + ``` + + 다른 Linux 배포판 사용자는: [NVIDIA Container Toolkit 설치 가이드](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)를 참조하십시오. + +2. fish-speech 이미지 가져오기 및 실행 + + ```bash + # 이미지 가져오기 + docker pull fishaudio/fish-speech:latest-dev + # 이미지 실행 + docker run -it \ + --name fish-speech \ + --gpus all \ + -p 7860:7860 \ + fishaudio/fish-speech:latest-dev \ + zsh + # 다른 포트를 사용하려면 -p 매개변수를 YourPort:7860으로 수정하세요 + ``` + +3. 모델 종속성 다운로드 + + Docker 컨테이너 내부의 터미널에서 아래 명령어를 사용하여 필요한 `vqgan` 및 `llama` 모델을 Huggingface 리포지토리에서 다운로드합니다. + + ```bash + huggingface-cli download fishaudio/fish-speech-1.4 --local-dir checkpoints/fish-speech-1.4 + ``` + +4. 환경 변수 설정 및 WebUI 접근 + + Docker 컨테이너 내부의 터미널에서 `export GRADIO_SERVER_NAME="0.0.0.0"`를 입력하여 Docker 내부에서 Gradio 서비스에 외부 접근을 허용합니다. + 이후, 터미널에서 `python tools/webui.py` 명령어를 입력하여 WebUI 서비스를 시작합니다. + + WSL 또는 macOS를 사용하는 경우 [http://localhost:7860](http://localhost:7860)에서 WebUI 인터페이스를 열 수 있습니다. + + 서버에 배포된 경우, localhost를 서버의 IP로 교체하세요. + +## 변경 사항 + +- 2024/09/10: Fish-Speech 1.4 버전으로 업데이트, 데이터셋 크기 증가 및 양자화기의 n_groups를 4에서 8로 변경. +- 2024/07/02: Fish-Speech 1.2 버전으로 업데이트, VITS 디코더 제거 및 제로샷 능력 크게 향상. +- 2024/05/10: Fish-Speech 1.1 버전으로 업데이트, WER 감소 및 음색 유사성을 개선하기 위해 VITS 디코더 구현. +- 2024/04/22: Fish-Speech 1.0 버전 완료, VQGAN 및 LLAMA 모델 대폭 수정. +- 2023/12/28: `lora` 파인튜닝 지원 추가. +- 2023/12/27: `gradient checkpointing`, `causual sampling`, 및 `flash-attn` 지원 추가. +- 2023/12/19: WebUI 및 HTTP API 업데이트. +- 2023/12/18: 파인튜닝 문서 및 관련 예시 업데이트. +- 2023/12/17: `text2semantic` 모델 업데이트, 음소 없는 모드 지원. +- 2023/12/13: 베타 버전 출시, VQGAN 모델 및 LLAMA 기반 언어 모델(음소 지원만 포함). + +## 감사의 말 + +- [VITS2 (daniilrobnikov)](https://github.com/daniilrobnikov/vits2) +- [Bert-VITS2](https://github.com/fishaudio/Bert-VITS2) +- [GPT VITS](https://github.com/innnky/gpt-vits) +- [MQTTS](https://github.com/b04901014/MQTTS) +- [GPT Fast](https://github.com/pytorch-labs/gpt-fast) +- [Transformers](https://github.com/huggingface/transformers) +- [GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS) diff --git a/docs/ko/inference.md b/docs/ko/inference.md new file mode 100644 index 00000000..65b3ec58 --- /dev/null +++ b/docs/ko/inference.md @@ -0,0 +1,134 @@ +# 추론 + +추론은 명령줄, HTTP API, 그리고 웹 UI에서 지원됩니다. + +!!! note + 전체 추론 과정은 다음의 여러 단계로 구성됩니다: + + 1. VQGAN을 사용하여 약 10초 분량의 음성을 인코딩합니다. + 2. 인코딩된 시맨틱 토큰과 해당 텍스트를 예시로 언어 모델에 입력합니다. + 3. 새로운 텍스트를 입력하면, 모델이 해당하는 시맨틱 토큰을 생성합니다. + 4. 생성된 시맨틱 토큰을 VITS / VQGAN에 입력하여 음성을 디코딩하고 생성합니다. + +## 명령줄 추론 + +필요한 `vqgan` 및 `llama` 모델을 Hugging Face 리포지토리에서 다운로드하세요. + +```bash +huggingface-cli download fishaudio/fish-speech-1.4 --local-dir checkpoints/fish-speech-1.4 +``` + +### 1. 음성에서 프롬프트 생성: + +!!! note + 모델이 음색을 무작위로 선택하도록 하려면 이 단계를 건너뛸 수 있습니다. + +```bash +python tools/vqgan/inference.py \ + -i "paimon.wav" \ + --checkpoint-path "checkpoints/fish-speech-1.4/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" +``` + +이 명령을 실행하면 `fake.npy` 파일을 얻게 됩니다. + +### 2. 텍스트에서 시맨틱 토큰 생성: + +```bash +python tools/llama/generate.py \ + --text "변환할 텍스트" \ + --prompt-text "참고할 텍스트" \ + --prompt-tokens "fake.npy" \ + --checkpoint-path "checkpoints/fish-speech-1.4" \ + --num-samples 2 \ + --compile +``` + +이 명령을 실행하면 작업 디렉토리에 `codes_N` 파일이 생성되며, N은 0부터 시작하는 정수입니다. + +!!! note + 빠른 추론을 위해 `--compile` 옵션을 사용하여 CUDA 커널을 결합할 수 있습니다 (~초당 30 토큰 -> ~초당 500 토큰). + `--compile` 매개변수를 주석 처리하여 가속화 옵션을 사용하지 않을 수도 있습니다. + +!!! info + bf16을 지원하지 않는 GPU의 경우 `--half` 매개변수를 사용해야 할 수 있습니다. + +### 3. 시맨틱 토큰에서 음성 생성: + +#### VQGAN 디코더 + +```bash +python tools/vqgan/inference.py \ + -i "codes_0.npy" \ + --checkpoint-path "checkpoints/fish-speech-1.4/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" +``` + +## HTTP API 추론 + +추론을 위한 HTTP API를 제공하고 있습니다. 아래의 명령어로 서버를 시작할 수 있습니다: + +```bash +python -m tools.api \ + --listen 0.0.0.0:8080 \ + --llama-checkpoint-path "checkpoints/fish-speech-1.4" \ + --decoder-checkpoint-path "checkpoints/fish-speech-1.4/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" \ + --decoder-config-name firefly_gan_vq +``` + +추론 속도를 높이고 싶다면 `--compile` 매개변수를 추가할 수 있습니다. + +이후, http://127.0.0.1:8080/ 에서 API를 확인하고 테스트할 수 있습니다. + +아래는 `tools/post_api.py`를 사용하여 요청을 보내는 예시입니다. + +```bash +python -m tools.post_api \ + --text "입력할 텍스트" \ + --reference_audio "참고 음성 경로" \ + --reference_text "참고 음성의 텍스트 내용" \ + --streaming True +``` + +위 명령은 참고 음성 정보를 바탕으로 원하는 음성을 합성하고, 스트리밍 방식으로 반환합니다. + +다음 예시는 여러 개의 참고 음성 경로와 텍스트를 한꺼번에 사용할 수 있음을 보여줍니다. 명령에서 공백으로 구분하여 입력합니다. + +```bash +python -m tools.post_api \ + --text "입력할 텍스트" \ + --reference_audio "참고 음성 경로1" "참고 음성 경로2" \ + --reference_text "참고 음성 텍스트1" "참고 음성 텍스트2"\ + --streaming False \ + --output "generated" \ + --format "mp3" +``` + +위 명령어는 여러 참고 음성 정보를 바탕으로 `MP3` 형식의 음성을 합성하여, 현재 디렉토리에 `generated.mp3`로 저장합니다. + +`--reference_audio`와 `--reference_text` 대신에 `--reference_id`(하나만 사용 가능)를 사용할 수 있습니다. 프로젝트 루트 디렉토리에 `references/` 폴더를 만들어 해당 음성과 주석 텍스트를 넣어야 합니다. 참고 음성은 최대 90초까지 지원됩니다. + +!!! info + 제공되는 파라미터는 `python -m tools.post_api -h`를 사용하여 확인할 수 있습니다. + +## GUI 추론 +[클라이언트 다운로드](https://github.com/AnyaCoder/fish-speech-gui/releases) + +## WebUI 추론 + +다음 명령으로 WebUI를 시작할 수 있습니다: + +```bash +python -m tools.webui \ + --llama-checkpoint-path "checkpoints/fish-speech-1.4" \ + --decoder-checkpoint-path "checkpoints/fish-speech-1.4/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" \ + --decoder-config-name firefly_gan_vq +``` + +> 추론 속도를 높이고 싶다면 `--compile` 매개변수를 추가할 수 있습니다. + +!!! note + 라벨 파일과 참고 음성 파일을 미리 메인 디렉토리의 `references` 폴더에 저장해 두면, WebUI에서 바로 호출할 수 있습니다. (해당 폴더는 직접 생성해야 합니다.) + +!!! note + WebUI를 구성하기 위해 `GRADIO_SHARE`, `GRADIO_SERVER_PORT`, `GRADIO_SERVER_NAME`과 같은 Gradio 환경 변수를 사용할 수 있습니다. + +즐기세요! diff --git a/docs/ko/samples.md b/docs/ko/samples.md new file mode 100644 index 00000000..5286a364 --- /dev/null +++ b/docs/ko/samples.md @@ -0,0 +1,137 @@ +# 샘플 + +ver 1.4 + +## Credits +[Seed-TTS (2024)](https://bytedancespeech.github.io/seedtts_tech_report/)에 감사드리며, 평가 데이터를 제공해 주셔서 이 데모를 완성할 수 있었습니다. + +모든 프롬프트 음성은 Seed-TTS 효과 데모 페이지에서 가져왔으며, 모든 생성된 음성은 fish-speech 버전 1.4에서 첫 번째로 생성된 것입니다. + +## 제로샷 인컨텍스트 학습 +- TODO: 한국어 제로샷 인컨텍스트 학습 샘플 추가. (현재는 영어와 중국어 데모만 제공됩니다.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
언어프롬프트동일 언어 생성교차 언어 생성
EN
I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.

顿时,气氛变得沉郁起来。乍看之下,一切的困扰仿佛都围绕在我身边。我皱着眉头,感受着那份压力,但我知道我不能放弃,不能认输。于是,我深吸一口气,心底的声音告诉我:“无论如何,都要冷静下来,重新开始。”

Dealing with family secrets is never easy. Yet, sometimes, omission is a form of protection, intending to safeguard some from the harsh truths. One day, I hope you understand the reasons behind my actions. Until then, Anna, please, bear with me.

处理家庭秘密从来都不是一件容易的事。然而,有时候,隐瞒是一种保护形式,旨在保护一些人免受残酷的真相伤害。有一天,我希望你能理解我行为背后的原因。在那之前,安娜,请容忍我。

The combinations of different textures and flavors create a perfect harmony. The succulence of the steak, the tartness of the cranberries, the crunch of pine nuts, and creaminess of blue cheese make it a truly delectable delight. Enjoy your culinary adventure!

听着你的话,我心里五味杂陈。虽然我愿意一直在你身边,承担一切不幸,但我知道只有让你自己面对,才能真正让你变得更强大。所以,你要记得,无论面对何种困难,都请你坚强,我会在心里一直支持你的。
ZH
突然,身边一阵笑声。我看着他们,意气风发地挺直了胸膛,甩了甩那稍显肉感的双臂,轻笑道:"我身上的肉,是为了掩饰我爆棚的魅力,否则,岂不吓坏了你们呢?"

Suddenly, there was a burst of laughter beside me. I looked at them, stood up straight with high spirit, shook the slightly fleshy arms, and smiled lightly, saying, "The flesh on my body is to hide my bursting charm. Otherwise, wouldn't it scare you?"

他闭上眼睛,期望这一切都能过去。然而,当他再次睁开眼睛,眼前的景象让他不禁倒吸一口气。雾气中出现的禁闭岛,陌生又熟悉,充满未知的危险。他握紧拳头,心知他的生活即将发生翻天覆地的改变。

He closed his eyes, expecting that all of this could pass. However, when he opened his eyes again, the sight in front of him made him couldn't help but take a deep breath. The closed island that appeared in the fog, strange and familiar, was full of unknown dangers. He tightened his fist, knowing that his life was about to undergo earth-shaking changes.

顿时,气氛变得沉郁起来。乍看之下,一切的困扰仿佛都围绕在我身边。我皱着眉头,感受着那份压力,但我知道我不能放弃,不能认输。于是,我深吸一口气,心底的声音告诉我:“无论如何,都要冷静下来,重新开始。”

Suddenly, the atmosphere became gloomy. At first glance, all the troubles seemed to surround me. I frowned, feeling that pressure, but I know I can't give up, can't admit defeat. So, I took a deep breath, and the voice in my heart told me, "Anyway, must calm down and start again."
+ +## 화자 파인튜닝 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
텍스트생성된 음성
화자1好呀,哈哈哈哈哈,喜欢笑的人运气都不会差哦,希望你每天笑口常开~
哇!恭喜你中了大乐透,八百万可真不少呢!有什么特别的计划或想法吗?
哼,你这么问是想请本小姐吃饭吗?如果对象是你的话,那也不是不可以。
화자2是呀,他还想换个地球仪哈哈哈,看来给你积累了一些快乐值了,你还想不想再听一个其他的笑话呀?
嘿嘿,你是不是也想拥有甜甜的恋爱呢?《微微一笑很倾城》是你的不二选择,男女主是校花校草类型,他们通过游戏结识,再到两人见面,全程没有一点误会,真的齁甜,想想都忍不住“姨妈笑”~
小傻瓜,嗯……算是个很可爱很亲切的名字,有点“独特”哦,不过我有些好奇,你为什么会给我选这个昵称呢?
+
+ +## 콘텐츠 편집 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
언어원본 텍스트원본 음성목표 텍스트편집된 음성
ENThey can't order me to stop dreaming. If you dream a thing more than once, it's sure to come true. Have faith in your dreams, and someday your rainbow will come shining through.They can't require me to stop imagining. If you envision a thing more than once, it's bound to come about. Have trust in your visions, and someday your radiance will come beaming through.
Are you familiar with it? Slice the steak and place the strips on top, then garnish with the dried cranberries, pine nuts, and blue cheese. I wonder how people rationalise the decision?Are you acquainted with it? Cut the pork and place the strips on top, then garnish with the dried cherries, almonds, and feta cheese. I query how people justify the choice?
ZH自古以来,庸君最怕党政了,可圣君他就不怕,不但不怕,反能利用。要我说,你就让明珠索额图互相争宠,只要你心里明白,左右逢源,你就能立于不败之地。从古至今,庸君最怕朝纲了,可君他就不怕,不但不怕,反能借助。要我说,你就让李四张三互相争宠,只要你心里清楚,左右周旋,你就能于不败之
对,这就是我,万人敬仰的太乙真人,虽然有点婴儿肥,但也掩不住我逼人的帅气。对,这就是我,众人尊崇的太白金星,虽然有点娃娃脸,但也不住我迷人魅力。
diff --git a/fish_speech/i18n/locale/ko_KR.json b/fish_speech/i18n/locale/ko_KR.json new file mode 100644 index 00000000..18026387 --- /dev/null +++ b/fish_speech/i18n/locale/ko_KR.json @@ -0,0 +1,123 @@ +{ + "16-mixed is recommended for 10+ series GPU": "10+ 시리즈 GPU에는 16-mixed를 권장합니다.", + "5 to 10 seconds of reference audio, useful for specifying speaker.": "화자를 특정하는 데 유의미한 5~10초의 길이의 참조 오디오 데이터.", + "A text-to-speech model based on VQ-GAN and Llama developed by [Fish Audio](https://fish.audio).": "[Fish Audio](https://fish.audio)에서 개발한 VQ-GAN 및 Llama 기반의 텍스트 음성 변환 모델.", + "Accumulate Gradient Batches": "그라디언트 배치 누적", + "Add to Processing Area": "처리 영역에 추가", + "Added path successfully!": "경로가 성공적으로 추가되었습니다!", + "Advanced Config": "고급 설정", + "Base LLAMA Model": "기본 LLAMA 모델", + "Batch Inference": "배치 추론", + "Batch Size": "배치 크기", + "Changing with the Model Path": "모델 경로에 따라 변경 중", + "Chinese": "중국어", + "Compile Model": "모델 컴파일", + "Compile the model can significantly reduce the inference time, but will increase cold start time": "모델을 컴파일하면 추론 시간이 크게 줄어들지만, 초기 시작 시간이 길어집니다.", + "Copy": "복사", + "Data Preprocessing": "데이터 전처리", + "Data Preprocessing Path": "데이터 전처리 경로", + "Data Source": "데이터 소스", + "Decoder Model Config": "디코더 모델 설정", + "Decoder Model Path": "디코더 모델 경로", + "Disabled": "비활성화 됨", + "Enable Reference Audio": "참고 음성 활성화", + "English": "영어", + "Error Message": "오류 메시지", + "File Preprocessing": "파일 전처리", + "Generate": "생성", + "Generated Audio": "생성된 오디오", + "If there is no corresponding text for the audio, apply ASR for assistance, support .txt or .lab format": "오디오애 대응하는 텍스트가 없을 경우, ASR을 적용해 지원하며, .txt 또는 .lab 형식을 지원합니다.", + "Infer interface is closed": "추론 인터페이스가 닫혔습니다.", + "Inference Configuration": "추론 설정", + "Inference Server Configuration": "추론 서버 설정", + "Inference Server Error": "추론 서버 오류", + "Inferring interface is launched at {}": "추론 인터페이스가 {}에서 시작되었습니다.", + "Initial Learning Rate": "초기 학습률", + "Input Audio & Source Path for Transcription": "전사할 입력 오디오 및 소스 경로", + "Input Text": "입력 텍스트", + "Invalid path: {}": "유효하지 않은 경로: {}", + "It is recommended to use CUDA, if you have low configuration, use CPU": "CUDA 사용을 권장하며, 낮은 사양일 경우 CPU를 사용하는 것을 권장합니다.", + "Iterative Prompt Length, 0 means off": "반복 프롬프트 길이. (0:비활성화)", + "Japanese": "일본어", + "LLAMA Configuration": "LLAMA 설정", + "LLAMA Model Config": "LLAMA 모델 설정", + "LLAMA Model Path": "LLAMA 모델 경로", + "Labeling Device": "라벨링 장치", + "LoRA Model to be merged": "병합할 LoRA 모델", + "Maximum Audio Duration": "최대 오디오 길이", + "Maximum Length per Sample": "샘플당 최대 길이", + "Maximum Training Steps": "최대 학습 단계", + "Maximum tokens per batch, 0 means no limit": "배치당 최대 토큰 수(0:제한 없음)", + "Merge": "병합", + "Merge LoRA": "LoRA 병합", + "Merge successfully": "성공적으로 병합 되었습니다.", + "Minimum Audio Duration": "최소 오디오 길이", + "Model Output Path": "모델 출력 경로", + "Model Size": "모델 크기", + "Move": "이동", + "Move files successfully": "파일이 성공적으로 이동되었습니다.", + "No audio generated, please check the input text.": "생성된 오디오가 없습니다. 입력된 텍스트를 확인하세요.", + "No selected options": "옵션이 선택되지 않았습니다.", + "Number of Workers": "작업자 수", + "Open Inference Server": "추론 서버 열기", + "Open Labeler WebUI": "라벨러 WebUI 열기", + "Open Tensorboard": "Tensorboard 열기", + "Opened labeler in browser": "브라우저에서 라벨러가 열렸습니다.", + "Optional Label Language": "선택적 라벨 언어", + "Optional online ver": "온라인 버전 선택", + "Output Path": "출력 경로", + "Path error, please check the model file exists in the corresponding path": "경로 오류, 해당 경로에 모델 파일이 있는지 확인하십시오.", + "Precision": "정밀도", + "Probability of applying Speaker Condition": "화자 조건 적용 확률", + "Put your text here.": "여기에 텍스트를 입력하세요.", + "Reference Audio": "참고 오디오", + "Reference Text": "참고 텍스트", + "Related code and weights are released under CC BY-NC-SA 4.0 License.": "관련 코드 및 가중치는 CC BY-NC-SA 4.0 라이선스 하에 배포됩니다.", + "Remove Selected Data": "선택한 데이터 제거", + "Removed path successfully!": "경로가 성공적으로 제거되었습니다!", + "Repetition Penalty": "반복 패널티", + "Save model every n steps": "n 단계마다 모델 저장", + "Select LLAMA ckpt": "LLAMA ckpt 선택", + "Select VITS ckpt": "VITS ckpt 선택", + "Select VQGAN ckpt": "VQGAN ckpt 선택", + "Select source file processing method": "소스 파일 처리 방법 선택", + "Select the model to be trained (Depending on the Tab page you are on)": "학습할 모델 선택(탭 페이지에 따라 다름)", + "Selected: {}": "선택됨: {}", + "Speaker": "화자", + "Speaker is identified by the folder name": "화자는 폴더 이름으로 식별됩니다", + "Start Training": "학습 시작", + "Streaming Audio": "스트리밍 오디오", + "Streaming Generate": "스트리밍 생성", + "Tensorboard Host": "Tensorboard 호스트", + "Tensorboard Log Path": "Tensorboard 로그 경로", + "Tensorboard Port": "Tensorboard 포트", + "Tensorboard interface is closed": "Tensorboard 인터페이스가 닫혔습니다", + "Tensorboard interface is launched at {}": "Tensorboard 인터페이스가 {}에서 시작되었습니다.", + "Text is too long, please keep it under {} characters.": "텍스트가 너무 깁니다. {}자 이하로 입력해주세요.", + "The path of the input folder on the left or the filelist. Whether checked or not, it will be used for subsequent training in this list.": "왼쪽의 입력 폴더 경로 또는 파일 목록의 경로. 체크 여부에 관계없이 이 목록에서 후속 학습에 사용됩니다.", + "Training Configuration": "학습 설정", + "Training Error": "학습 오류", + "Training stopped": "학습이 중지되었습니다.", + "Type name of the speaker": "화자의 이름을 입력하세요.", + "Type the path or select from the dropdown": "경로를 입력하거나 드롭다운에서 선택하세요.", + "Use LoRA": "LoRA 사용", + "Use LoRA can save GPU memory, but may reduce the quality of the model": "LoRA를 사용하면 GPU 메모리를 절약할 수 있지만, 모델의 품질이 저하될 수 있습니다.", + "Use filelist": "파일 목록 사용", + "Use large for 10G+ GPU, medium for 5G, small for 2G": "10G+ GPU 환경에선 large, 5G에선 medium, 2G에선 small을 사용할 것을 권장합니다.", + "VITS Configuration": "VITS 설정", + "VQGAN Configuration": "VQGAN 설정", + "Validation Batch Size": "검증 배치 크기", + "View the status of the preprocessing folder (use the slider to control the depth of the tree)": "전처리 폴더의 상태를 확인합니다(슬라이더를 사용하여 트리의 깊이를 조절합니다)", + "We are not responsible for any misuse of the model, please consider your local laws and regulations before using it.": "모델의 오용에 대해 책임지지 않습니다. 사용하기 전에 현지 법률과 규정을 고려하시길 바랍니다.", + "WebUI Host": "WebUI 호스트", + "WebUI Port": "WebUI 포트", + "Whisper Model": "Whisper 모델", + "You can find the source code [here](https://github.com/fishaudio/fish-speech) and models [here](https://huggingface.co/fishaudio/fish-speech-1).": "소스 코드는 [이곳](https://github.com/fishaudio/fish-speech)에서, 모델은 [이곳](https://huggingface.co/fishaudio/fish-speech-1)에서 확인하실 수 있습니다.", + "bf16-true is recommended for 30+ series GPU, 16-mixed is recommended for 10+ series GPU": "30+ 시리즈 GPU에는 bf16-true를, 10+ 시리즈 GPU에는 16-mixed를 권장합니다", + "latest": "최신", + "new": "새로운", + "Realtime Transform Text": "실시간 텍스트 변환", + "Normalization Result Preview (Currently Only Chinese)": "정규화 결과 미리보기(현재 중국어만 지원)", + "Text Normalization": "텍스트 정규화", + "Select Example Audio": "예시 오디오 선택" +}