Skip to content

Commit

Permalink
For Better Experience for Mainland China users (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyaCoder authored Dec 23, 2023
1 parent 597970a commit 1ac1938
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/zh/finetune.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ python tools/vqgan/extract_vq.py data/demo \
```bash
python tools/llama/build_dataset.py \
--config "fish_speech/configs/data/finetune.yaml" \
--output "data/quantized-dataset-ft.protos"
--num_workers 16
--output "data/quantized-dataset-ft.protos" \
--num-workers 16
```

命令执行完毕后, 你应该能在 `data` 目录下看到 `quantized-dataset-ft.protos` 文件.
Expand Down
16 changes: 14 additions & 2 deletions docs/zh/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,32 @@ python tools/vqgan/inference.py \
## HTTP API 推理

运行以下命令来启动 HTTP 服务:

```bash
python -m zibai tools.api_server:app --listen 127.0.0.1:8000
# 推荐中国大陆用户运行以下命令来启动 HTTP 服务:
HF_ENDPOINT=https://hf-mirror.com python -m zibai tools.api_server:app --listen 127.0.0.1:8000
```

随后, 你可以在 `http://127.0.0.1:8000/docs` 中查看并测试 API.
一般来说, 你需要先调用 `PUT /v1/models/default` 来加载模型, 然后调用 `POST /v1/models/default/invoke` 来进行推理. 具体的参数请参考 API 文档.

一般来说, 你需要先调用 `PUT /v1/models/default` 来加载模型, 然后调用 `POST /v1/models/default/invoke` 来进行推理.
具体的参数请参考 API 文档.

## WebUI 推理

在运行 WebUI 之前, 你需要先启动 HTTP 服务, 如上所述.

随后你可以使用以下命令来启动 WebUI:

```bash
python fish_speech/webui/app.py
```

或附带参数来启动 WebUI:

```bash
# 以临时环境变量的方式启动:
GRADIO_SERVER_NAME=127.0.0.1 GRADIO_SERVER_PORT=7860 python fish_speech/webui/app.py
```

祝大家玩得开心!
2 changes: 1 addition & 1 deletion fish_speech/webui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import librosa
import requests

from fish_speech.text import parse_text_to_segments, segments_to_phones
from fish_speech.text import parse_text_to_segments

HEADER_MD = """
# Fish Speech
Expand Down
7 changes: 3 additions & 4 deletions tools/llama/build_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import re
from collections import defaultdict
from multiprocessing import Pool
Expand Down Expand Up @@ -123,16 +122,16 @@ def run_task(task):
)
@click.option("--output", type=click.Path(), default="data/quantized-dataset-ft.protos")
@click.option("--filelist", type=click.Path(), default=None)
@click.option("--num_worker", type=int, default=16)
def main(config, output, filelist, num_worker):
@click.option("--num_workers", type=int, default=16)
def main(config, output, filelist, num_workers):
dataset_fp = open(output, "wb")
generator_fn = (
task_generator_yaml(config)
if filelist is None
else task_generator_filelist(filelist)
)

with Pool(num_worker) as p:
with Pool(num_workers) as p:
for result in tqdm(p.imap_unordered(run_task, generator_fn)):
dataset_fp.write(result)

Expand Down

0 comments on commit 1ac1938

Please sign in to comment.