Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#236 from luyao-cv/develop
Browse files Browse the repository at this point in the history
[Audio Chat] fix bug
  • Loading branch information
luyao-cv authored Oct 16, 2023
2 parents 3dff0ec + 501d063 commit 6d20f5e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions paddlemix/appflow/text2speech_synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
from .apptask import AppTask
import paddle
from paddlemix.utils.log import logger
import paddle.nn as nn, paddle
def get_parameter_dtype(parameter: nn.Layer) -> paddle.dtype:
try:
return next(parameter.named_parameters())[1].dtype
except StopIteration:
try:
return next(parameter.named_buffers())[1].dtype
except StopIteration:
return parameter._dtype
@property
def dtype_getter(self):
if hasattr(self, "__dtype"):
return self.__dtype
return get_parameter_dtype(self)
nn.Layer.dtype = dtype_getter

@nn.Layer.dtype.setter
def dtype_setter(self, value):
self.__dtype = value
nn.Layer.dtype = dtype_setter


class AudioTTSTask(AppTask):
Expand All @@ -24,6 +44,7 @@ def __init__(self, task, model, **kwargs):

# Default to static mode
self._static_mode = False

self._construct_model()

def _construct_model(self):
Expand Down

0 comments on commit 6d20f5e

Please sign in to comment.