chore(vllm): rename Post_model to PostModel

This commit is contained in:
源文雨
2024-07-24 21:52:04 +08:00
parent 9cd5620276
commit f54ddaad14
3 changed files with 7 additions and 9 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ from huggingface_hub import snapshot_download
from .config import Config
from .model.velocity.llm import LLM
from .model.velocity.post_model import Post_model
from .model.velocity.post_model import PostModel
from .model.velocity.sampling_params import SamplingParams
from .model import DVAE, GPT, gen_logits, Tokenizer
from .utils import (
@@ -308,7 +308,7 @@ class Chat:
pathlib.Path("asset/vllm_model").mkdir(parents=True, exist_ok=True)
self.gpt.gpt.save_pretrained("asset/vllm_model/gpt")
self.post_model = (
Post_model(
PostModel(
self.config.gpt.hidden_size,
self.config.gpt.num_audio_tokens,
self.config.gpt.num_text_tokens,
+2 -2
View File
@@ -22,7 +22,7 @@ from ChatTTS.model.velocity.sequence import (
SequenceOutput,
)
from vllm.utils import in_wsl
from ChatTTS.model.velocity.post_model import Post_model, Sampler
from ChatTTS.model.velocity.post_model import PostModel, Sampler
from safetensors.torch import safe_open
logger = init_logger(__name__)
@@ -78,7 +78,7 @@ class ModelRunner:
def load_model(self) -> None:
self.model = get_model(self.model_config)
self.post_model = Post_model(
self.post_model = PostModel(
self.model_config.get_hidden_size(),
self.model_config.num_audio_tokens,
self.model_config.num_text_tokens,
+3 -5
View File
@@ -1,12 +1,10 @@
import os, platform
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
"""
https://stackoverflow.com/questions/62691279/how-to-disable-tokenizers-parallelism-true-false-warning
"""
import logging
import torch
import torch.nn as nn
from torch.functional import F
@@ -14,7 +12,7 @@ from torch.nn.utils.parametrizations import weight_norm
from typing import List, Callable
class Post_model(nn.Module):
class PostModel(nn.Module):
def __init__(
self, hidden_size: int, num_audio_tokens: int, num_text_tokens: int, num_vq=4
):
@@ -74,7 +72,7 @@ class Post_model(nn.Module):
class Sampler:
def __init__(self, post_model: Post_model, num_audio_tokens: int, num_vq: int):
def __init__(self, post_model: PostModel, num_audio_tokens: int, num_vq: int):
self.post_model = post_model
self.device = next(self.post_model.parameters()).device
self.num_audio_tokens = num_audio_tokens