File size: 6,126 Bytes
5fc76ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# μΆλ‘
μΆλ‘ μ λͺ
λ Ήμ€, HTTP API, κ·Έλ¦¬κ³ μΉ UIμμ μ§μλ©λλ€.
!!! note
μ 체 μΆλ‘ κ³Όμ μ λ€μμ μ¬λ¬ λ¨κ³λ‘ ꡬμ±λ©λλ€:
1. VQGANμ μ¬μ©νμ¬ μ½ 10μ΄ λΆλμ μμ±μ μΈμ½λ©ν©λλ€.
2. μΈμ½λ©λ μλ§¨ν± ν ν°κ³Ό ν΄λΉ ν
μ€νΈλ₯Ό μμλ‘ μΈμ΄ λͺ¨λΈμ μ
λ ₯ν©λλ€.
3. μλ‘μ΄ ν
μ€νΈλ₯Ό μ
λ ₯νλ©΄, λͺ¨λΈμ΄ ν΄λΉνλ μλ§¨ν± ν ν°μ μμ±ν©λλ€.
4. μμ±λ μλ§¨ν± ν ν°μ VITS / VQGANμ μ
λ ₯νμ¬ μμ±μ λμ½λ©νκ³ μμ±ν©λλ€.
## λͺ¨λΈ λ€μ΄λ‘λ
νμν `vqgan` λ° `llama` λͺ¨λΈμ Hugging Face 리ν¬μ§ν 리μμ λ€μ΄λ‘λνμΈμ.
```bash
huggingface-cli download fishaudio/fish-speech-1.5 --local-dir checkpoints/fish-speech-1.5
```
## λͺ
λ Ήμ€ μΆλ‘
### 1. μμ±μμ ν둬ννΈ μμ±:
!!! note
λͺ¨λΈμ΄ μμμ 무μμλ‘ μ ννλλ‘ νλ €λ©΄ μ΄ λ¨κ³λ₯Ό 건λλΈ μ μμ΅λλ€.
!!! warning "ν₯ν λ²μ κ²½κ³ "
μλ κ²½λ‘(tools/vqgan/infernce.py)μμ μ κ·Όν μ μλ μΈν°νμ΄μ€λ μ μ§νμ§λ§, μ΄ μΈν°νμ΄μ€λ ν₯ν λͺλͺ λ²μ μμ μμ λ μ μμ΅λλ€. κ°λ₯ν ν 빨리 μ½λλ₯Ό λ³κ²½νμμμ€.
```bash
python fish_speech/models/vqgan/inference.py \
-i "paimon.wav" \
--checkpoint-path "checkpoints/fish-speech-1.5/firefly-gan-vq-fsq-8x1024-21hz-generator.pth"
```
μ΄ λͺ
λ Ήμ μ€ννλ©΄ `fake.npy` νμΌμ μ»κ² λ©λλ€.
### 2. ν
μ€νΈμμ μλ§¨ν± ν ν° μμ±:
!!! warning "ν₯ν λ²μ κ²½κ³ "
μλ κ²½λ‘(tools/llama/generate.py)μμ μ κ·Όν μ μλ μΈν°νμ΄μ€λ μ μ§νμ§λ§, μ΄ μΈν°νμ΄μ€λ ν₯ν λͺλͺ λ²μ μμ μμ λ μ μμ΅λλ€. κ°λ₯ν ν 빨리 μ½λλ₯Ό λ³κ²½νμμμ€.
```bash
python fish_speech/models/text2semantic/inference.py \
--text "λ³νν ν
μ€νΈ" \
--prompt-text "μ°Έκ³ ν ν
μ€νΈ" \
--prompt-tokens "fake.npy" \
--checkpoint-path "checkpoints/fish-speech-1.5" \
--num-samples 2 \
--compile
```
μ΄ λͺ
λ Ήμ μ€ννλ©΄ μμ
λλ ν 리μ `codes_N` νμΌμ΄ μμ±λλ©°, Nμ 0λΆν° μμνλ μ μμ
λλ€.
!!! note
λΉ λ₯Έ μΆλ‘ μ μν΄ `--compile` μ΅μ
μ μ¬μ©νμ¬ CUDA 컀λμ κ²°ν©ν μ μμ΅λλ€ (~μ΄λΉ 30 ν ν° -> ~μ΄λΉ 500 ν ν°).
`--compile` 맀κ°λ³μλ₯Ό μ£Όμ μ²λ¦¬νμ¬ κ°μν μ΅μ
μ μ¬μ©νμ§ μμ μλ μμ΅λλ€.
!!! info
bf16μ μ§μνμ§ μλ GPUμ κ²½μ° `--half` 맀κ°λ³μλ₯Ό μ¬μ©ν΄μΌ ν μ μμ΅λλ€.
### 3. μλ§¨ν± ν ν°μμ μμ± μμ±:
#### VQGAN λμ½λ
!!! warning "ν₯ν λ²μ κ²½κ³ "
μλ κ²½λ‘(tools/vqgan/infernce.py)μμ μ κ·Όν μ μλ μΈν°νμ΄μ€λ μ μ§νμ§λ§, μ΄ μΈν°νμ΄μ€λ ν₯ν λͺλͺ λ²μ μμ μμ λ μ μμ΅λλ€. κ°λ₯ν ν 빨리 μ½λλ₯Ό λ³κ²½νμμμ€.
```bash
python fish_speech/models/vqgan/inference.py \
-i "codes_0.npy" \
--checkpoint-path "checkpoints/fish-speech-1.5/firefly-gan-vq-fsq-8x1024-21hz-generator.pth"
```
## HTTP API μΆλ‘
μΆλ‘ μ μν HTTP APIλ₯Ό μ 곡νκ³ μμ΅λλ€. μλμ λͺ
λ Ήμ΄λ‘ μλ²λ₯Ό μμν μ μμ΅λλ€:
```bash
python -m tools.api_server \
--listen 0.0.0.0:8080 \
--llama-checkpoint-path "checkpoints/fish-speech-1.5" \
--decoder-checkpoint-path "checkpoints/fish-speech-1.5/firefly-gan-vq-fsq-8x1024-21hz-generator.pth" \
--decoder-config-name firefly_gan_vq
```
μΆλ‘ μλλ₯Ό λμ΄κ³ μΆλ€λ©΄ `--compile` 맀κ°λ³μλ₯Ό μΆκ°ν μ μμ΅λλ€.
μ΄ν, http://127.0.0.1:8080/ μμ APIλ₯Ό νμΈνκ³ ν
μ€νΈν μ μμ΅λλ€.
μλλ `tools/api_client.py`λ₯Ό μ¬μ©νμ¬ μμ²μ 보λ΄λ μμμ
λλ€.
```bash
python -m tools.api_client \
--text "μ
λ ₯ν ν
μ€νΈ" \
--reference_audio "μ°Έκ³ μμ± κ²½λ‘" \
--reference_text "μ°Έκ³ μμ±μ ν
μ€νΈ λ΄μ©" \
--streaming True
```
μ λͺ
λ Ήμ μ°Έκ³ μμ± μ 보λ₯Ό λ°νμΌλ‘ μνλ μμ±μ ν©μ±νκ³ , μ€νΈλ¦¬λ° λ°©μμΌλ‘ λ°νν©λλ€.
λ€μ μμλ μ¬λ¬ κ°μ μ°Έκ³ μμ± κ²½λ‘μ ν
μ€νΈλ₯Ό νκΊΌλ²μ μ¬μ©ν μ μμμ 보μ¬μ€λλ€. λͺ
λ Ήμμ 곡백μΌλ‘ ꡬλΆνμ¬ μ
λ ₯ν©λλ€.
```bash
python -m tools.api_client \
--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/<your reference_id>` ν΄λλ₯Ό λ§λ€μ΄ ν΄λΉ μμ±κ³Ό μ£Όμ ν
μ€νΈλ₯Ό λ£μ΄μΌ ν©λλ€. μ°Έκ³ μμ±μ μ΅λ 90μ΄κΉμ§ μ§μλ©λλ€.
!!! info
μ 곡λλ νλΌλ―Έν°λ `python -m tools.api_client -h`λ₯Ό μ¬μ©νμ¬ νμΈν μ μμ΅λλ€.
## GUI μΆλ‘
[ν΄λΌμ΄μΈνΈ λ€μ΄λ‘λ](https://github.com/AnyaCoder/fish-speech-gui/releases)
## WebUI μΆλ‘
λ€μ λͺ
λ ΉμΌλ‘ WebUIλ₯Ό μμν μ μμ΅λλ€:
```bash
python -m tools.run_webui \
--llama-checkpoint-path "checkpoints/fish-speech-1.5" \
--decoder-checkpoint-path "checkpoints/fish-speech-1.5/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 νκ²½ λ³μλ₯Ό μ¬μ©ν μ μμ΅λλ€.
μ¦κΈ°μΈμ!
|