mirror of
https://github.com/2noise/ChatTTS.git
synced 2026-08-29 02:10:59 +08:00
chore(format): run black on dev (#598)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4ebccbad08
commit
03c4bbef54
@@ -1,5 +1,6 @@
|
||||
import torch
|
||||
|
||||
|
||||
class LlamaRMSNorm(torch.nn.Module):
|
||||
def __init__(self, hidden_size, eps=1e-6):
|
||||
"""
|
||||
|
||||
@@ -34,9 +34,7 @@ def replace_decoder(te_decoder_cls, llama_rms_norm_cls):
|
||||
transformers.models.llama.modeling_llama.LlamaDecoderLayer
|
||||
)
|
||||
transformers.models.llama.modeling_llama.LlamaDecoderLayer = te_decoder_cls
|
||||
original_llama_rms_norm_cls = (
|
||||
transformers.models.llama.modeling_llama.LlamaRMSNorm
|
||||
)
|
||||
original_llama_rms_norm_cls = transformers.models.llama.modeling_llama.LlamaRMSNorm
|
||||
transformers.models.llama.modeling_llama.LlamaRMSNorm = llama_rms_norm_cls
|
||||
try:
|
||||
yield
|
||||
@@ -44,7 +42,9 @@ def replace_decoder(te_decoder_cls, llama_rms_norm_cls):
|
||||
transformers.models.llama.modeling_llama.LlamaDecoderLayer = (
|
||||
original_llama_decoder_cls
|
||||
)
|
||||
transformers.models.llama.modeling_llama.LlamaRMSNorm = original_llama_rms_norm_cls
|
||||
transformers.models.llama.modeling_llama.LlamaRMSNorm = (
|
||||
original_llama_rms_norm_cls
|
||||
)
|
||||
|
||||
|
||||
class TELlamaDecoderLayer(te.pytorch.TransformerLayer):
|
||||
@@ -104,7 +104,9 @@ class TELlamaModel:
|
||||
"""
|
||||
|
||||
def __new__(cls, config: LlamaConfig):
|
||||
with replace_decoder(te_decoder_cls=TELlamaDecoderLayer, llama_rms_norm_cls=LlamaRMSNorm):
|
||||
with replace_decoder(
|
||||
te_decoder_cls=TELlamaDecoderLayer, llama_rms_norm_cls=LlamaRMSNorm
|
||||
):
|
||||
model = LlamaModel(config)
|
||||
return model
|
||||
|
||||
|
||||
@@ -151,7 +151,15 @@ def refine_text(
|
||||
|
||||
|
||||
def generate_audio(
|
||||
text, temperature, top_P, top_K, spk_emb_text: str, stream, audio_seed_input, sample_text_input, sample_audio_code_input,
|
||||
text,
|
||||
temperature,
|
||||
top_P,
|
||||
top_K,
|
||||
spk_emb_text: str,
|
||||
stream,
|
||||
audio_seed_input,
|
||||
sample_text_input,
|
||||
sample_audio_code_input,
|
||||
):
|
||||
global chat, has_interrupted
|
||||
|
||||
|
||||
@@ -158,7 +158,8 @@ def main():
|
||||
|
||||
sample_audio_input.change(
|
||||
fn=on_upload_sample_audio,
|
||||
inputs=sample_audio_input, outputs=sample_audio_code_input,
|
||||
inputs=sample_audio_input,
|
||||
outputs=sample_audio_code_input,
|
||||
).then(fn=lambda: gr.Info("Sampled Audio Code generated at another Tab."))
|
||||
|
||||
# 使用Gradio的回调功能来更新数值输入框
|
||||
|
||||
Reference in New Issue
Block a user