Skip to content

Commit

Permalink
chore(format): run black on dev (#597)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] committed Jul 19, 2024
1 parent 0d716c3 commit 72a6f80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ChatTTS/model/cuda/te_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def __new__(cls, config: LlamaConfig):

@classmethod
def from_state_dict(
cls, state_dict: Dict[str, torch.Tensor], config: LlamaConfig,
cls,
state_dict: Dict[str, torch.Tensor],
config: LlamaConfig,
):
"""
Custom method adapted from `from_pretrained` method in HuggingFace
Expand Down
6 changes: 4 additions & 2 deletions ChatTTS/model/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ def __init__(
for _ in range(self.num_vq)
],
)

def from_pretrained(self, file_path: str):

self.load_state_dict(torch.load(file_path, weights_only=True, mmap=True))

if "cuda" in str(self.device_gpt) and platform.system().lower() == "linux": # is TELlamaModel
if (
"cuda" in str(self.device_gpt) and platform.system().lower() == "linux"
): # is TELlamaModel
try:
from .cuda import TELlamaModel

Expand Down

0 comments on commit 72a6f80

Please sign in to comment.