Skip to content

Commit

Permalink
doc: add vLLM instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 24, 2024
1 parent a9af30b commit 9d7c437
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions ChatTTS/model/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import gc
from pathlib import Path

from safetensors.torch import save_file
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down Expand Up @@ -92,6 +91,8 @@ def __init__(

def from_pretrained(self, file_path: str):
if self.is_vllm and platform.system().lower() == "linux":
from safetensors.torch import save_file

from .velocity.llm import LLM
from .velocity.post_model import PostModel

Expand All @@ -104,7 +105,7 @@ def from_pretrained(self, file_path: str):
gpt.gpt.save_pretrained(vllm_folder / "gpt")
post_model = (
PostModel(
int(self.gpt.config.hidden_size),
int(gpt.gpt.config.hidden_size),
self.num_audio_tokens,
self.num_text_tokens,
)
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ conda activate chattts
pip install -r requirements.txt
```

#### Optional: Install TransformerEngine if using NVIDIA GPU (Linux only)
#### Optional: Install vLLM (Linux only)
```bash
pip install safetensors vllm==0.2.7 torchaudio
```

#### Unrecommended Optional: Install TransformerEngine if using NVIDIA GPU (Linux only)
> [!Note]
> The installation process is very slow.
Expand All @@ -113,7 +118,7 @@ pip install -r requirements.txt
pip install git+https://github.com/NVIDIA/TransformerEngine.git@stable
```

#### Optional: Install FlashAttention-2 (mainly NVIDIA GPU)
#### Unrecommended Optional: Install FlashAttention-2 (mainly NVIDIA GPU)
> [!Note]
> See supported devices at the [Hugging Face Doc](https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2).
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ WeTextProcessing; sys_platform == 'linux'
nemo_text_processing; sys_platform == 'linux'
av
pydub
safetensors
vllm>=0.2.7; sys_platform == 'linux'
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"transformers>=4.41.1",
"vector_quantize_pytorch",
"vocos",
"safetensors",
],
platforms="any",
classifiers=[
Expand Down

0 comments on commit 9d7c437

Please sign in to comment.