(self,
in_channels=3,
out_channels=3,
z_channels=64,
num_res_blocks=2,
model_path=None,
weight_dict={},
world_size=1,
version=2,
)
| 907 | |
| 908 | class StepVideoVAE(nn.Module): |
| 909 | def __init__(self, |
| 910 | in_channels=3, |
| 911 | out_channels=3, |
| 912 | z_channels=64, |
| 913 | num_res_blocks=2, |
| 914 | model_path=None, |
| 915 | weight_dict={}, |
| 916 | world_size=1, |
| 917 | version=2, |
| 918 | ): |
| 919 | super().__init__() |
| 920 | |
| 921 | self.frame_len = 17 |
| 922 | self.latent_len = 3 if version == 2 else 5 |
| 923 | |
| 924 | base_group_norm.spatial = True if version == 2 else False |
| 925 | |
| 926 | self.encoder = VideoEncoder( |
| 927 | in_channels=in_channels, |
| 928 | z_channels=z_channels, |
| 929 | num_res_blocks=num_res_blocks, |
| 930 | version=version, |
| 931 | ) |
| 932 | |
| 933 | self.decoder = VideoDecoder( |
| 934 | z_channels=z_channels, |
| 935 | out_channels=out_channels, |
| 936 | num_res_blocks=num_res_blocks, |
| 937 | version=version, |
| 938 | ) |
| 939 | |
| 940 | if model_path is not None: |
| 941 | weight_dict = self.init_from_ckpt(model_path) |
| 942 | if len(weight_dict) != 0: |
| 943 | self.load_from_dict(weight_dict) |
| 944 | self.convert_channel_last() |
| 945 | |
| 946 | self.world_size = world_size |
| 947 | |
| 948 | def init_from_ckpt(self, model_path): |
| 949 | from safetensors import safe_open |
nothing calls this directly
no test coverage detected