diff --git a/mindone/diffusers/models/autoencoders/autoencoder_asym_kl.py b/mindone/diffusers/models/autoencoders/autoencoder_asym_kl.py index d535d275f6..ae2e496c45 100644 --- a/mindone/diffusers/models/autoencoders/autoencoder_asym_kl.py +++ b/mindone/diffusers/models/autoencoders/autoencoder_asym_kl.py @@ -13,6 +13,8 @@ # limitations under the License. from typing import Optional, Tuple, Union +import numpy as np + import mindspore as ms from mindspore import nn @@ -138,6 +140,7 @@ def _decode( def decode( self, z: ms.Tensor, + generator: Optional[np.random.Generator] = None, image: Optional[ms.Tensor] = None, mask: Optional[ms.Tensor] = None, return_dict: bool = False, diff --git a/mindone/diffusers/models/autoencoders/vae.py b/mindone/diffusers/models/autoencoders/vae.py index f66f997cc7..305c56b327 100644 --- a/mindone/diffusers/models/autoencoders/vae.py +++ b/mindone/diffusers/models/autoencoders/vae.py @@ -380,7 +380,9 @@ def __init__( ) in_ch_ = out_ch_ - self.layers = nn.SequentialCell(*layers) + # nn.SequentialCell does not support the len(self.layers) method nor does it support self.layers[l], + # therefore, we use nn.CellList instead. + self.layers = nn.CellList(layers) def construct(self, x: ms.Tensor, mask=None) -> ms.Tensor: r"""The forward method of the `MaskConditionEncoder` class."""