diffsynth 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. diffsynth/__init__.py +6 -0
  2. diffsynth/configs/__init__.py +0 -0
  3. diffsynth/configs/model_config.py +243 -0
  4. diffsynth/controlnets/__init__.py +2 -0
  5. diffsynth/controlnets/controlnet_unit.py +53 -0
  6. diffsynth/controlnets/processors.py +51 -0
  7. diffsynth/data/__init__.py +1 -0
  8. diffsynth/data/simple_text_image.py +35 -0
  9. diffsynth/data/video.py +148 -0
  10. diffsynth/extensions/ESRGAN/__init__.py +118 -0
  11. diffsynth/extensions/FastBlend/__init__.py +63 -0
  12. diffsynth/extensions/FastBlend/api.py +397 -0
  13. diffsynth/extensions/FastBlend/cupy_kernels.py +119 -0
  14. diffsynth/extensions/FastBlend/data.py +146 -0
  15. diffsynth/extensions/FastBlend/patch_match.py +298 -0
  16. diffsynth/extensions/FastBlend/runners/__init__.py +4 -0
  17. diffsynth/extensions/FastBlend/runners/accurate.py +35 -0
  18. diffsynth/extensions/FastBlend/runners/balanced.py +46 -0
  19. diffsynth/extensions/FastBlend/runners/fast.py +141 -0
  20. diffsynth/extensions/FastBlend/runners/interpolation.py +121 -0
  21. diffsynth/extensions/RIFE/__init__.py +242 -0
  22. diffsynth/extensions/__init__.py +0 -0
  23. diffsynth/models/__init__.py +1 -0
  24. diffsynth/models/attention.py +89 -0
  25. diffsynth/models/downloader.py +66 -0
  26. diffsynth/models/hunyuan_dit.py +451 -0
  27. diffsynth/models/hunyuan_dit_text_encoder.py +163 -0
  28. diffsynth/models/kolors_text_encoder.py +1363 -0
  29. diffsynth/models/lora.py +195 -0
  30. diffsynth/models/model_manager.py +536 -0
  31. diffsynth/models/sd3_dit.py +798 -0
  32. diffsynth/models/sd3_text_encoder.py +1107 -0
  33. diffsynth/models/sd3_vae_decoder.py +81 -0
  34. diffsynth/models/sd3_vae_encoder.py +95 -0
  35. diffsynth/models/sd_controlnet.py +588 -0
  36. diffsynth/models/sd_ipadapter.py +57 -0
  37. diffsynth/models/sd_motion.py +199 -0
  38. diffsynth/models/sd_text_encoder.py +321 -0
  39. diffsynth/models/sd_unet.py +1108 -0
  40. diffsynth/models/sd_vae_decoder.py +336 -0
  41. diffsynth/models/sd_vae_encoder.py +282 -0
  42. diffsynth/models/sdxl_ipadapter.py +122 -0
  43. diffsynth/models/sdxl_motion.py +104 -0
  44. diffsynth/models/sdxl_text_encoder.py +759 -0
  45. diffsynth/models/sdxl_unet.py +1899 -0
  46. diffsynth/models/sdxl_vae_decoder.py +24 -0
  47. diffsynth/models/sdxl_vae_encoder.py +24 -0
  48. diffsynth/models/svd_image_encoder.py +505 -0
  49. diffsynth/models/svd_unet.py +2004 -0
  50. diffsynth/models/svd_vae_decoder.py +578 -0
  51. diffsynth/models/svd_vae_encoder.py +139 -0
  52. diffsynth/models/tiler.py +106 -0
  53. diffsynth/pipelines/__init__.py +9 -0
  54. diffsynth/pipelines/base.py +34 -0
  55. diffsynth/pipelines/dancer.py +178 -0
  56. diffsynth/pipelines/hunyuan_image.py +274 -0
  57. diffsynth/pipelines/pipeline_runner.py +105 -0
  58. diffsynth/pipelines/sd3_image.py +132 -0
  59. diffsynth/pipelines/sd_image.py +173 -0
  60. diffsynth/pipelines/sd_video.py +266 -0
  61. diffsynth/pipelines/sdxl_image.py +191 -0
  62. diffsynth/pipelines/sdxl_video.py +223 -0
  63. diffsynth/pipelines/svd_video.py +297 -0
  64. diffsynth/processors/FastBlend.py +142 -0
  65. diffsynth/processors/PILEditor.py +28 -0
  66. diffsynth/processors/RIFE.py +77 -0
  67. diffsynth/processors/__init__.py +0 -0
  68. diffsynth/processors/base.py +6 -0
  69. diffsynth/processors/sequencial_processor.py +41 -0
  70. diffsynth/prompters/__init__.py +6 -0
  71. diffsynth/prompters/base_prompter.py +57 -0
  72. diffsynth/prompters/hunyuan_dit_prompter.py +69 -0
  73. diffsynth/prompters/kolors_prompter.py +353 -0
  74. diffsynth/prompters/prompt_refiners.py +77 -0
  75. diffsynth/prompters/sd3_prompter.py +92 -0
  76. diffsynth/prompters/sd_prompter.py +73 -0
  77. diffsynth/prompters/sdxl_prompter.py +61 -0
  78. diffsynth/schedulers/__init__.py +3 -0
  79. diffsynth/schedulers/continuous_ode.py +59 -0
  80. diffsynth/schedulers/ddim.py +79 -0
  81. diffsynth/schedulers/flow_match.py +51 -0
  82. diffsynth/tokenizer_configs/__init__.py +0 -0
  83. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/special_tokens_map.json +7 -0
  84. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/tokenizer_config.json +16 -0
  85. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/vocab.txt +47020 -0
  86. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer/vocab_org.txt +21128 -0
  87. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/config.json +28 -0
  88. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/special_tokens_map.json +1 -0
  89. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/spiece.model +0 -0
  90. diffsynth/tokenizer_configs/hunyuan_dit/tokenizer_t5/tokenizer_config.json +1 -0
  91. diffsynth/tokenizer_configs/kolors/tokenizer/tokenizer.model +0 -0
  92. diffsynth/tokenizer_configs/kolors/tokenizer/tokenizer_config.json +12 -0
  93. diffsynth/tokenizer_configs/kolors/tokenizer/vocab.txt +0 -0
  94. diffsynth/tokenizer_configs/stable_diffusion/tokenizer/merges.txt +48895 -0
  95. diffsynth/tokenizer_configs/stable_diffusion/tokenizer/special_tokens_map.json +24 -0
  96. diffsynth/tokenizer_configs/stable_diffusion/tokenizer/tokenizer_config.json +34 -0
  97. diffsynth/tokenizer_configs/stable_diffusion/tokenizer/vocab.json +49410 -0
  98. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/merges.txt +48895 -0
  99. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/special_tokens_map.json +30 -0
  100. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/tokenizer_config.json +30 -0
  101. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_1/vocab.json +49410 -0
  102. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/merges.txt +48895 -0
  103. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/special_tokens_map.json +30 -0
  104. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/tokenizer_config.json +38 -0
  105. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_2/vocab.json +49410 -0
  106. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/special_tokens_map.json +125 -0
  107. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/spiece.model +0 -0
  108. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/tokenizer.json +129428 -0
  109. diffsynth/tokenizer_configs/stable_diffusion_3/tokenizer_3/tokenizer_config.json +940 -0
  110. diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/merges.txt +40213 -0
  111. diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/special_tokens_map.json +24 -0
  112. diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/tokenizer_config.json +38 -0
  113. diffsynth/tokenizer_configs/stable_diffusion_xl/tokenizer_2/vocab.json +49411 -0
  114. diffsynth/trainers/__init__.py +0 -0
  115. diffsynth/trainers/text_to_image.py +253 -0
  116. diffsynth-1.0.0.dist-info/LICENSE +201 -0
  117. diffsynth-1.0.0.dist-info/METADATA +23 -0
  118. diffsynth-1.0.0.dist-info/RECORD +120 -0
  119. diffsynth-1.0.0.dist-info/WHEEL +5 -0
  120. diffsynth-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,578 @@
1
+ import torch
2
+ from .attention import Attention
3
+ from .sd_unet import ResnetBlock, UpSampler
4
+ from .tiler import TileWorker
5
+ from einops import rearrange, repeat
6
+
7
+
8
+ class VAEAttentionBlock(torch.nn.Module):
9
+
10
+ def __init__(self, num_attention_heads, attention_head_dim, in_channels, num_layers=1, norm_num_groups=32, eps=1e-5):
11
+ super().__init__()
12
+ inner_dim = num_attention_heads * attention_head_dim
13
+
14
+ self.norm = torch.nn.GroupNorm(num_groups=norm_num_groups, num_channels=in_channels, eps=eps, affine=True)
15
+
16
+ self.transformer_blocks = torch.nn.ModuleList([
17
+ Attention(
18
+ inner_dim,
19
+ num_attention_heads,
20
+ attention_head_dim,
21
+ bias_q=True,
22
+ bias_kv=True,
23
+ bias_out=True
24
+ )
25
+ for d in range(num_layers)
26
+ ])
27
+
28
+ def forward(self, hidden_states, time_emb, text_emb, res_stack):
29
+ batch, _, height, width = hidden_states.shape
30
+ residual = hidden_states
31
+
32
+ hidden_states = self.norm(hidden_states)
33
+ inner_dim = hidden_states.shape[1]
34
+ hidden_states = hidden_states.permute(0, 2, 3, 1).reshape(batch, height * width, inner_dim)
35
+
36
+ for block in self.transformer_blocks:
37
+ hidden_states = block(hidden_states)
38
+
39
+ hidden_states = hidden_states.reshape(batch, height, width, inner_dim).permute(0, 3, 1, 2).contiguous()
40
+ hidden_states = hidden_states + residual
41
+
42
+ return hidden_states, time_emb, text_emb, res_stack
43
+
44
+
45
+ class TemporalResnetBlock(torch.nn.Module):
46
+
47
+ def __init__(self, in_channels, out_channels, groups=32, eps=1e-5):
48
+ super().__init__()
49
+ self.norm1 = torch.nn.GroupNorm(num_groups=groups, num_channels=in_channels, eps=eps, affine=True)
50
+ self.conv1 = torch.nn.Conv3d(in_channels, out_channels, kernel_size=(3, 1, 1), stride=1, padding=(1, 0, 0))
51
+ self.norm2 = torch.nn.GroupNorm(num_groups=groups, num_channels=out_channels, eps=eps, affine=True)
52
+ self.conv2 = torch.nn.Conv3d(out_channels, out_channels, kernel_size=(3, 1, 1), stride=1, padding=(1, 0, 0))
53
+ self.nonlinearity = torch.nn.SiLU()
54
+ self.mix_factor = torch.nn.Parameter(torch.Tensor([0.5]))
55
+
56
+ def forward(self, hidden_states, time_emb, text_emb, res_stack, **kwargs):
57
+ x_spatial = hidden_states
58
+ x = rearrange(hidden_states, "T C H W -> 1 C T H W")
59
+ x = self.norm1(x)
60
+ x = self.nonlinearity(x)
61
+ x = self.conv1(x)
62
+ x = self.norm2(x)
63
+ x = self.nonlinearity(x)
64
+ x = self.conv2(x)
65
+ x_temporal = hidden_states + x[0].permute(1, 0, 2, 3)
66
+ alpha = torch.sigmoid(self.mix_factor)
67
+ hidden_states = alpha * x_temporal + (1 - alpha) * x_spatial
68
+ return hidden_states, time_emb, text_emb, res_stack
69
+
70
+
71
+ class SVDVAEDecoder(torch.nn.Module):
72
+ def __init__(self):
73
+ super().__init__()
74
+ self.scaling_factor = 0.18215
75
+ self.conv_in = torch.nn.Conv2d(4, 512, kernel_size=3, padding=1)
76
+
77
+ self.blocks = torch.nn.ModuleList([
78
+ # UNetMidBlock
79
+ ResnetBlock(512, 512, eps=1e-6),
80
+ TemporalResnetBlock(512, 512, eps=1e-6),
81
+ VAEAttentionBlock(1, 512, 512, 1, eps=1e-6),
82
+ ResnetBlock(512, 512, eps=1e-6),
83
+ TemporalResnetBlock(512, 512, eps=1e-6),
84
+ # UpDecoderBlock
85
+ ResnetBlock(512, 512, eps=1e-6),
86
+ TemporalResnetBlock(512, 512, eps=1e-6),
87
+ ResnetBlock(512, 512, eps=1e-6),
88
+ TemporalResnetBlock(512, 512, eps=1e-6),
89
+ ResnetBlock(512, 512, eps=1e-6),
90
+ TemporalResnetBlock(512, 512, eps=1e-6),
91
+ UpSampler(512),
92
+ # UpDecoderBlock
93
+ ResnetBlock(512, 512, eps=1e-6),
94
+ TemporalResnetBlock(512, 512, eps=1e-6),
95
+ ResnetBlock(512, 512, eps=1e-6),
96
+ TemporalResnetBlock(512, 512, eps=1e-6),
97
+ ResnetBlock(512, 512, eps=1e-6),
98
+ TemporalResnetBlock(512, 512, eps=1e-6),
99
+ UpSampler(512),
100
+ # UpDecoderBlock
101
+ ResnetBlock(512, 256, eps=1e-6),
102
+ TemporalResnetBlock(256, 256, eps=1e-6),
103
+ ResnetBlock(256, 256, eps=1e-6),
104
+ TemporalResnetBlock(256, 256, eps=1e-6),
105
+ ResnetBlock(256, 256, eps=1e-6),
106
+ TemporalResnetBlock(256, 256, eps=1e-6),
107
+ UpSampler(256),
108
+ # UpDecoderBlock
109
+ ResnetBlock(256, 128, eps=1e-6),
110
+ TemporalResnetBlock(128, 128, eps=1e-6),
111
+ ResnetBlock(128, 128, eps=1e-6),
112
+ TemporalResnetBlock(128, 128, eps=1e-6),
113
+ ResnetBlock(128, 128, eps=1e-6),
114
+ TemporalResnetBlock(128, 128, eps=1e-6),
115
+ ])
116
+
117
+ self.conv_norm_out = torch.nn.GroupNorm(num_channels=128, num_groups=32, eps=1e-5)
118
+ self.conv_act = torch.nn.SiLU()
119
+ self.conv_out = torch.nn.Conv2d(128, 3, kernel_size=3, padding=1)
120
+ self.time_conv_out = torch.nn.Conv3d(3, 3, kernel_size=(3, 1, 1), padding=(1, 0, 0))
121
+
122
+
123
+ def forward(self, sample):
124
+ # 1. pre-process
125
+ hidden_states = rearrange(sample, "C T H W -> T C H W")
126
+ hidden_states = hidden_states / self.scaling_factor
127
+ hidden_states = self.conv_in(hidden_states)
128
+ time_emb, text_emb, res_stack = None, None, None
129
+
130
+ # 2. blocks
131
+ for i, block in enumerate(self.blocks):
132
+ hidden_states, time_emb, text_emb, res_stack = block(hidden_states, time_emb, text_emb, res_stack)
133
+
134
+ # 3. output
135
+ hidden_states = self.conv_norm_out(hidden_states)
136
+ hidden_states = self.conv_act(hidden_states)
137
+ hidden_states = self.conv_out(hidden_states)
138
+ hidden_states = rearrange(hidden_states, "T C H W -> C T H W")
139
+ hidden_states = self.time_conv_out(hidden_states)
140
+
141
+ return hidden_states
142
+
143
+
144
+ def build_mask(self, data, is_bound):
145
+ _, T, H, W = data.shape
146
+ t = repeat(torch.arange(T), "T -> T H W", T=T, H=H, W=W)
147
+ h = repeat(torch.arange(H), "H -> T H W", T=T, H=H, W=W)
148
+ w = repeat(torch.arange(W), "W -> T H W", T=T, H=H, W=W)
149
+ border_width = (T + H + W) // 6
150
+ pad = torch.ones_like(t) * border_width
151
+ mask = torch.stack([
152
+ pad if is_bound[0] else t + 1,
153
+ pad if is_bound[1] else T - t,
154
+ pad if is_bound[2] else h + 1,
155
+ pad if is_bound[3] else H - h,
156
+ pad if is_bound[4] else w + 1,
157
+ pad if is_bound[5] else W - w
158
+ ]).min(dim=0).values
159
+ mask = mask.clip(1, border_width)
160
+ mask = (mask / border_width).to(dtype=data.dtype, device=data.device)
161
+ mask = rearrange(mask, "T H W -> 1 T H W")
162
+ return mask
163
+
164
+
165
+ def decode_video(
166
+ self, sample,
167
+ batch_time=8, batch_height=128, batch_width=128,
168
+ stride_time=4, stride_height=32, stride_width=32,
169
+ progress_bar=lambda x:x
170
+ ):
171
+ sample = sample.permute(1, 0, 2, 3)
172
+ data_device = sample.device
173
+ computation_device = self.conv_in.weight.device
174
+ torch_dtype = sample.dtype
175
+ _, T, H, W = sample.shape
176
+
177
+ weight = torch.zeros((1, T, H*8, W*8), dtype=torch_dtype, device=data_device)
178
+ values = torch.zeros((3, T, H*8, W*8), dtype=torch_dtype, device=data_device)
179
+
180
+ # Split tasks
181
+ tasks = []
182
+ for t in range(0, T, stride_time):
183
+ for h in range(0, H, stride_height):
184
+ for w in range(0, W, stride_width):
185
+ if (t-stride_time >= 0 and t-stride_time+batch_time >= T)\
186
+ or (h-stride_height >= 0 and h-stride_height+batch_height >= H)\
187
+ or (w-stride_width >= 0 and w-stride_width+batch_width >= W):
188
+ continue
189
+ tasks.append((t, t+batch_time, h, h+batch_height, w, w+batch_width))
190
+
191
+ # Run
192
+ for tl, tr, hl, hr, wl, wr in progress_bar(tasks):
193
+ sample_batch = sample[:, tl:tr, hl:hr, wl:wr].to(computation_device)
194
+ sample_batch = self.forward(sample_batch).to(data_device)
195
+ mask = self.build_mask(sample_batch, is_bound=(tl==0, tr>=T, hl==0, hr>=H, wl==0, wr>=W))
196
+ values[:, tl:tr, hl*8:hr*8, wl*8:wr*8] += sample_batch * mask
197
+ weight[:, tl:tr, hl*8:hr*8, wl*8:wr*8] += mask
198
+ values /= weight
199
+ return values
200
+
201
+
202
+ @staticmethod
203
+ def state_dict_converter():
204
+ return SVDVAEDecoderStateDictConverter()
205
+
206
+
207
+ class SVDVAEDecoderStateDictConverter:
208
+ def __init__(self):
209
+ pass
210
+
211
+ def from_diffusers(self, state_dict):
212
+ static_rename_dict = {
213
+ "decoder.conv_in": "conv_in",
214
+ "decoder.mid_block.attentions.0.group_norm": "blocks.2.norm",
215
+ "decoder.mid_block.attentions.0.to_q": "blocks.2.transformer_blocks.0.to_q",
216
+ "decoder.mid_block.attentions.0.to_k": "blocks.2.transformer_blocks.0.to_k",
217
+ "decoder.mid_block.attentions.0.to_v": "blocks.2.transformer_blocks.0.to_v",
218
+ "decoder.mid_block.attentions.0.to_out.0": "blocks.2.transformer_blocks.0.to_out",
219
+ "decoder.up_blocks.0.upsamplers.0.conv": "blocks.11.conv",
220
+ "decoder.up_blocks.1.upsamplers.0.conv": "blocks.18.conv",
221
+ "decoder.up_blocks.2.upsamplers.0.conv": "blocks.25.conv",
222
+ "decoder.conv_norm_out": "conv_norm_out",
223
+ "decoder.conv_out": "conv_out",
224
+ "decoder.time_conv_out": "time_conv_out"
225
+ }
226
+ prefix_rename_dict = {
227
+ "decoder.mid_block.resnets.0.spatial_res_block": "blocks.0",
228
+ "decoder.mid_block.resnets.0.temporal_res_block": "blocks.1",
229
+ "decoder.mid_block.resnets.0.time_mixer": "blocks.1",
230
+ "decoder.mid_block.resnets.1.spatial_res_block": "blocks.3",
231
+ "decoder.mid_block.resnets.1.temporal_res_block": "blocks.4",
232
+ "decoder.mid_block.resnets.1.time_mixer": "blocks.4",
233
+
234
+ "decoder.up_blocks.0.resnets.0.spatial_res_block": "blocks.5",
235
+ "decoder.up_blocks.0.resnets.0.temporal_res_block": "blocks.6",
236
+ "decoder.up_blocks.0.resnets.0.time_mixer": "blocks.6",
237
+ "decoder.up_blocks.0.resnets.1.spatial_res_block": "blocks.7",
238
+ "decoder.up_blocks.0.resnets.1.temporal_res_block": "blocks.8",
239
+ "decoder.up_blocks.0.resnets.1.time_mixer": "blocks.8",
240
+ "decoder.up_blocks.0.resnets.2.spatial_res_block": "blocks.9",
241
+ "decoder.up_blocks.0.resnets.2.temporal_res_block": "blocks.10",
242
+ "decoder.up_blocks.0.resnets.2.time_mixer": "blocks.10",
243
+
244
+ "decoder.up_blocks.1.resnets.0.spatial_res_block": "blocks.12",
245
+ "decoder.up_blocks.1.resnets.0.temporal_res_block": "blocks.13",
246
+ "decoder.up_blocks.1.resnets.0.time_mixer": "blocks.13",
247
+ "decoder.up_blocks.1.resnets.1.spatial_res_block": "blocks.14",
248
+ "decoder.up_blocks.1.resnets.1.temporal_res_block": "blocks.15",
249
+ "decoder.up_blocks.1.resnets.1.time_mixer": "blocks.15",
250
+ "decoder.up_blocks.1.resnets.2.spatial_res_block": "blocks.16",
251
+ "decoder.up_blocks.1.resnets.2.temporal_res_block": "blocks.17",
252
+ "decoder.up_blocks.1.resnets.2.time_mixer": "blocks.17",
253
+
254
+ "decoder.up_blocks.2.resnets.0.spatial_res_block": "blocks.19",
255
+ "decoder.up_blocks.2.resnets.0.temporal_res_block": "blocks.20",
256
+ "decoder.up_blocks.2.resnets.0.time_mixer": "blocks.20",
257
+ "decoder.up_blocks.2.resnets.1.spatial_res_block": "blocks.21",
258
+ "decoder.up_blocks.2.resnets.1.temporal_res_block": "blocks.22",
259
+ "decoder.up_blocks.2.resnets.1.time_mixer": "blocks.22",
260
+ "decoder.up_blocks.2.resnets.2.spatial_res_block": "blocks.23",
261
+ "decoder.up_blocks.2.resnets.2.temporal_res_block": "blocks.24",
262
+ "decoder.up_blocks.2.resnets.2.time_mixer": "blocks.24",
263
+
264
+ "decoder.up_blocks.3.resnets.0.spatial_res_block": "blocks.26",
265
+ "decoder.up_blocks.3.resnets.0.temporal_res_block": "blocks.27",
266
+ "decoder.up_blocks.3.resnets.0.time_mixer": "blocks.27",
267
+ "decoder.up_blocks.3.resnets.1.spatial_res_block": "blocks.28",
268
+ "decoder.up_blocks.3.resnets.1.temporal_res_block": "blocks.29",
269
+ "decoder.up_blocks.3.resnets.1.time_mixer": "blocks.29",
270
+ "decoder.up_blocks.3.resnets.2.spatial_res_block": "blocks.30",
271
+ "decoder.up_blocks.3.resnets.2.temporal_res_block": "blocks.31",
272
+ "decoder.up_blocks.3.resnets.2.time_mixer": "blocks.31",
273
+ }
274
+ suffix_rename_dict = {
275
+ "norm1.weight": "norm1.weight",
276
+ "conv1.weight": "conv1.weight",
277
+ "norm2.weight": "norm2.weight",
278
+ "conv2.weight": "conv2.weight",
279
+ "conv_shortcut.weight": "conv_shortcut.weight",
280
+ "norm1.bias": "norm1.bias",
281
+ "conv1.bias": "conv1.bias",
282
+ "norm2.bias": "norm2.bias",
283
+ "conv2.bias": "conv2.bias",
284
+ "conv_shortcut.bias": "conv_shortcut.bias",
285
+ "mix_factor": "mix_factor",
286
+ }
287
+
288
+ state_dict_ = {}
289
+ for name in static_rename_dict:
290
+ state_dict_[static_rename_dict[name] + ".weight"] = state_dict[name + ".weight"]
291
+ state_dict_[static_rename_dict[name] + ".bias"] = state_dict[name + ".bias"]
292
+ for prefix_name in prefix_rename_dict:
293
+ for suffix_name in suffix_rename_dict:
294
+ name = prefix_name + "." + suffix_name
295
+ name_ = prefix_rename_dict[prefix_name] + "." + suffix_rename_dict[suffix_name]
296
+ if name in state_dict:
297
+ state_dict_[name_] = state_dict[name]
298
+
299
+ return state_dict_
300
+
301
+
302
+ def from_civitai(self, state_dict):
303
+ rename_dict = {
304
+ "first_stage_model.decoder.conv_in.bias": "conv_in.bias",
305
+ "first_stage_model.decoder.conv_in.weight": "conv_in.weight",
306
+ "first_stage_model.decoder.conv_out.bias": "conv_out.bias",
307
+ "first_stage_model.decoder.conv_out.time_mix_conv.bias": "time_conv_out.bias",
308
+ "first_stage_model.decoder.conv_out.time_mix_conv.weight": "time_conv_out.weight",
309
+ "first_stage_model.decoder.conv_out.weight": "conv_out.weight",
310
+ "first_stage_model.decoder.mid.attn_1.k.bias": "blocks.2.transformer_blocks.0.to_k.bias",
311
+ "first_stage_model.decoder.mid.attn_1.k.weight": "blocks.2.transformer_blocks.0.to_k.weight",
312
+ "first_stage_model.decoder.mid.attn_1.norm.bias": "blocks.2.norm.bias",
313
+ "first_stage_model.decoder.mid.attn_1.norm.weight": "blocks.2.norm.weight",
314
+ "first_stage_model.decoder.mid.attn_1.proj_out.bias": "blocks.2.transformer_blocks.0.to_out.bias",
315
+ "first_stage_model.decoder.mid.attn_1.proj_out.weight": "blocks.2.transformer_blocks.0.to_out.weight",
316
+ "first_stage_model.decoder.mid.attn_1.q.bias": "blocks.2.transformer_blocks.0.to_q.bias",
317
+ "first_stage_model.decoder.mid.attn_1.q.weight": "blocks.2.transformer_blocks.0.to_q.weight",
318
+ "first_stage_model.decoder.mid.attn_1.v.bias": "blocks.2.transformer_blocks.0.to_v.bias",
319
+ "first_stage_model.decoder.mid.attn_1.v.weight": "blocks.2.transformer_blocks.0.to_v.weight",
320
+ "first_stage_model.decoder.mid.block_1.conv1.bias": "blocks.0.conv1.bias",
321
+ "first_stage_model.decoder.mid.block_1.conv1.weight": "blocks.0.conv1.weight",
322
+ "first_stage_model.decoder.mid.block_1.conv2.bias": "blocks.0.conv2.bias",
323
+ "first_stage_model.decoder.mid.block_1.conv2.weight": "blocks.0.conv2.weight",
324
+ "first_stage_model.decoder.mid.block_1.mix_factor": "blocks.1.mix_factor",
325
+ "first_stage_model.decoder.mid.block_1.norm1.bias": "blocks.0.norm1.bias",
326
+ "first_stage_model.decoder.mid.block_1.norm1.weight": "blocks.0.norm1.weight",
327
+ "first_stage_model.decoder.mid.block_1.norm2.bias": "blocks.0.norm2.bias",
328
+ "first_stage_model.decoder.mid.block_1.norm2.weight": "blocks.0.norm2.weight",
329
+ "first_stage_model.decoder.mid.block_1.time_stack.in_layers.0.bias": "blocks.1.norm1.bias",
330
+ "first_stage_model.decoder.mid.block_1.time_stack.in_layers.0.weight": "blocks.1.norm1.weight",
331
+ "first_stage_model.decoder.mid.block_1.time_stack.in_layers.2.bias": "blocks.1.conv1.bias",
332
+ "first_stage_model.decoder.mid.block_1.time_stack.in_layers.2.weight": "blocks.1.conv1.weight",
333
+ "first_stage_model.decoder.mid.block_1.time_stack.out_layers.0.bias": "blocks.1.norm2.bias",
334
+ "first_stage_model.decoder.mid.block_1.time_stack.out_layers.0.weight": "blocks.1.norm2.weight",
335
+ "first_stage_model.decoder.mid.block_1.time_stack.out_layers.3.bias": "blocks.1.conv2.bias",
336
+ "first_stage_model.decoder.mid.block_1.time_stack.out_layers.3.weight": "blocks.1.conv2.weight",
337
+ "first_stage_model.decoder.mid.block_2.conv1.bias": "blocks.3.conv1.bias",
338
+ "first_stage_model.decoder.mid.block_2.conv1.weight": "blocks.3.conv1.weight",
339
+ "first_stage_model.decoder.mid.block_2.conv2.bias": "blocks.3.conv2.bias",
340
+ "first_stage_model.decoder.mid.block_2.conv2.weight": "blocks.3.conv2.weight",
341
+ "first_stage_model.decoder.mid.block_2.mix_factor": "blocks.4.mix_factor",
342
+ "first_stage_model.decoder.mid.block_2.norm1.bias": "blocks.3.norm1.bias",
343
+ "first_stage_model.decoder.mid.block_2.norm1.weight": "blocks.3.norm1.weight",
344
+ "first_stage_model.decoder.mid.block_2.norm2.bias": "blocks.3.norm2.bias",
345
+ "first_stage_model.decoder.mid.block_2.norm2.weight": "blocks.3.norm2.weight",
346
+ "first_stage_model.decoder.mid.block_2.time_stack.in_layers.0.bias": "blocks.4.norm1.bias",
347
+ "first_stage_model.decoder.mid.block_2.time_stack.in_layers.0.weight": "blocks.4.norm1.weight",
348
+ "first_stage_model.decoder.mid.block_2.time_stack.in_layers.2.bias": "blocks.4.conv1.bias",
349
+ "first_stage_model.decoder.mid.block_2.time_stack.in_layers.2.weight": "blocks.4.conv1.weight",
350
+ "first_stage_model.decoder.mid.block_2.time_stack.out_layers.0.bias": "blocks.4.norm2.bias",
351
+ "first_stage_model.decoder.mid.block_2.time_stack.out_layers.0.weight": "blocks.4.norm2.weight",
352
+ "first_stage_model.decoder.mid.block_2.time_stack.out_layers.3.bias": "blocks.4.conv2.bias",
353
+ "first_stage_model.decoder.mid.block_2.time_stack.out_layers.3.weight": "blocks.4.conv2.weight",
354
+ "first_stage_model.decoder.norm_out.bias": "conv_norm_out.bias",
355
+ "first_stage_model.decoder.norm_out.weight": "conv_norm_out.weight",
356
+ "first_stage_model.decoder.up.0.block.0.conv1.bias": "blocks.26.conv1.bias",
357
+ "first_stage_model.decoder.up.0.block.0.conv1.weight": "blocks.26.conv1.weight",
358
+ "first_stage_model.decoder.up.0.block.0.conv2.bias": "blocks.26.conv2.bias",
359
+ "first_stage_model.decoder.up.0.block.0.conv2.weight": "blocks.26.conv2.weight",
360
+ "first_stage_model.decoder.up.0.block.0.mix_factor": "blocks.27.mix_factor",
361
+ "first_stage_model.decoder.up.0.block.0.nin_shortcut.bias": "blocks.26.conv_shortcut.bias",
362
+ "first_stage_model.decoder.up.0.block.0.nin_shortcut.weight": "blocks.26.conv_shortcut.weight",
363
+ "first_stage_model.decoder.up.0.block.0.norm1.bias": "blocks.26.norm1.bias",
364
+ "first_stage_model.decoder.up.0.block.0.norm1.weight": "blocks.26.norm1.weight",
365
+ "first_stage_model.decoder.up.0.block.0.norm2.bias": "blocks.26.norm2.bias",
366
+ "first_stage_model.decoder.up.0.block.0.norm2.weight": "blocks.26.norm2.weight",
367
+ "first_stage_model.decoder.up.0.block.0.time_stack.in_layers.0.bias": "blocks.27.norm1.bias",
368
+ "first_stage_model.decoder.up.0.block.0.time_stack.in_layers.0.weight": "blocks.27.norm1.weight",
369
+ "first_stage_model.decoder.up.0.block.0.time_stack.in_layers.2.bias": "blocks.27.conv1.bias",
370
+ "first_stage_model.decoder.up.0.block.0.time_stack.in_layers.2.weight": "blocks.27.conv1.weight",
371
+ "first_stage_model.decoder.up.0.block.0.time_stack.out_layers.0.bias": "blocks.27.norm2.bias",
372
+ "first_stage_model.decoder.up.0.block.0.time_stack.out_layers.0.weight": "blocks.27.norm2.weight",
373
+ "first_stage_model.decoder.up.0.block.0.time_stack.out_layers.3.bias": "blocks.27.conv2.bias",
374
+ "first_stage_model.decoder.up.0.block.0.time_stack.out_layers.3.weight": "blocks.27.conv2.weight",
375
+ "first_stage_model.decoder.up.0.block.1.conv1.bias": "blocks.28.conv1.bias",
376
+ "first_stage_model.decoder.up.0.block.1.conv1.weight": "blocks.28.conv1.weight",
377
+ "first_stage_model.decoder.up.0.block.1.conv2.bias": "blocks.28.conv2.bias",
378
+ "first_stage_model.decoder.up.0.block.1.conv2.weight": "blocks.28.conv2.weight",
379
+ "first_stage_model.decoder.up.0.block.1.mix_factor": "blocks.29.mix_factor",
380
+ "first_stage_model.decoder.up.0.block.1.norm1.bias": "blocks.28.norm1.bias",
381
+ "first_stage_model.decoder.up.0.block.1.norm1.weight": "blocks.28.norm1.weight",
382
+ "first_stage_model.decoder.up.0.block.1.norm2.bias": "blocks.28.norm2.bias",
383
+ "first_stage_model.decoder.up.0.block.1.norm2.weight": "blocks.28.norm2.weight",
384
+ "first_stage_model.decoder.up.0.block.1.time_stack.in_layers.0.bias": "blocks.29.norm1.bias",
385
+ "first_stage_model.decoder.up.0.block.1.time_stack.in_layers.0.weight": "blocks.29.norm1.weight",
386
+ "first_stage_model.decoder.up.0.block.1.time_stack.in_layers.2.bias": "blocks.29.conv1.bias",
387
+ "first_stage_model.decoder.up.0.block.1.time_stack.in_layers.2.weight": "blocks.29.conv1.weight",
388
+ "first_stage_model.decoder.up.0.block.1.time_stack.out_layers.0.bias": "blocks.29.norm2.bias",
389
+ "first_stage_model.decoder.up.0.block.1.time_stack.out_layers.0.weight": "blocks.29.norm2.weight",
390
+ "first_stage_model.decoder.up.0.block.1.time_stack.out_layers.3.bias": "blocks.29.conv2.bias",
391
+ "first_stage_model.decoder.up.0.block.1.time_stack.out_layers.3.weight": "blocks.29.conv2.weight",
392
+ "first_stage_model.decoder.up.0.block.2.conv1.bias": "blocks.30.conv1.bias",
393
+ "first_stage_model.decoder.up.0.block.2.conv1.weight": "blocks.30.conv1.weight",
394
+ "first_stage_model.decoder.up.0.block.2.conv2.bias": "blocks.30.conv2.bias",
395
+ "first_stage_model.decoder.up.0.block.2.conv2.weight": "blocks.30.conv2.weight",
396
+ "first_stage_model.decoder.up.0.block.2.mix_factor": "blocks.31.mix_factor",
397
+ "first_stage_model.decoder.up.0.block.2.norm1.bias": "blocks.30.norm1.bias",
398
+ "first_stage_model.decoder.up.0.block.2.norm1.weight": "blocks.30.norm1.weight",
399
+ "first_stage_model.decoder.up.0.block.2.norm2.bias": "blocks.30.norm2.bias",
400
+ "first_stage_model.decoder.up.0.block.2.norm2.weight": "blocks.30.norm2.weight",
401
+ "first_stage_model.decoder.up.0.block.2.time_stack.in_layers.0.bias": "blocks.31.norm1.bias",
402
+ "first_stage_model.decoder.up.0.block.2.time_stack.in_layers.0.weight": "blocks.31.norm1.weight",
403
+ "first_stage_model.decoder.up.0.block.2.time_stack.in_layers.2.bias": "blocks.31.conv1.bias",
404
+ "first_stage_model.decoder.up.0.block.2.time_stack.in_layers.2.weight": "blocks.31.conv1.weight",
405
+ "first_stage_model.decoder.up.0.block.2.time_stack.out_layers.0.bias": "blocks.31.norm2.bias",
406
+ "first_stage_model.decoder.up.0.block.2.time_stack.out_layers.0.weight": "blocks.31.norm2.weight",
407
+ "first_stage_model.decoder.up.0.block.2.time_stack.out_layers.3.bias": "blocks.31.conv2.bias",
408
+ "first_stage_model.decoder.up.0.block.2.time_stack.out_layers.3.weight": "blocks.31.conv2.weight",
409
+ "first_stage_model.decoder.up.1.block.0.conv1.bias": "blocks.19.conv1.bias",
410
+ "first_stage_model.decoder.up.1.block.0.conv1.weight": "blocks.19.conv1.weight",
411
+ "first_stage_model.decoder.up.1.block.0.conv2.bias": "blocks.19.conv2.bias",
412
+ "first_stage_model.decoder.up.1.block.0.conv2.weight": "blocks.19.conv2.weight",
413
+ "first_stage_model.decoder.up.1.block.0.mix_factor": "blocks.20.mix_factor",
414
+ "first_stage_model.decoder.up.1.block.0.nin_shortcut.bias": "blocks.19.conv_shortcut.bias",
415
+ "first_stage_model.decoder.up.1.block.0.nin_shortcut.weight": "blocks.19.conv_shortcut.weight",
416
+ "first_stage_model.decoder.up.1.block.0.norm1.bias": "blocks.19.norm1.bias",
417
+ "first_stage_model.decoder.up.1.block.0.norm1.weight": "blocks.19.norm1.weight",
418
+ "first_stage_model.decoder.up.1.block.0.norm2.bias": "blocks.19.norm2.bias",
419
+ "first_stage_model.decoder.up.1.block.0.norm2.weight": "blocks.19.norm2.weight",
420
+ "first_stage_model.decoder.up.1.block.0.time_stack.in_layers.0.bias": "blocks.20.norm1.bias",
421
+ "first_stage_model.decoder.up.1.block.0.time_stack.in_layers.0.weight": "blocks.20.norm1.weight",
422
+ "first_stage_model.decoder.up.1.block.0.time_stack.in_layers.2.bias": "blocks.20.conv1.bias",
423
+ "first_stage_model.decoder.up.1.block.0.time_stack.in_layers.2.weight": "blocks.20.conv1.weight",
424
+ "first_stage_model.decoder.up.1.block.0.time_stack.out_layers.0.bias": "blocks.20.norm2.bias",
425
+ "first_stage_model.decoder.up.1.block.0.time_stack.out_layers.0.weight": "blocks.20.norm2.weight",
426
+ "first_stage_model.decoder.up.1.block.0.time_stack.out_layers.3.bias": "blocks.20.conv2.bias",
427
+ "first_stage_model.decoder.up.1.block.0.time_stack.out_layers.3.weight": "blocks.20.conv2.weight",
428
+ "first_stage_model.decoder.up.1.block.1.conv1.bias": "blocks.21.conv1.bias",
429
+ "first_stage_model.decoder.up.1.block.1.conv1.weight": "blocks.21.conv1.weight",
430
+ "first_stage_model.decoder.up.1.block.1.conv2.bias": "blocks.21.conv2.bias",
431
+ "first_stage_model.decoder.up.1.block.1.conv2.weight": "blocks.21.conv2.weight",
432
+ "first_stage_model.decoder.up.1.block.1.mix_factor": "blocks.22.mix_factor",
433
+ "first_stage_model.decoder.up.1.block.1.norm1.bias": "blocks.21.norm1.bias",
434
+ "first_stage_model.decoder.up.1.block.1.norm1.weight": "blocks.21.norm1.weight",
435
+ "first_stage_model.decoder.up.1.block.1.norm2.bias": "blocks.21.norm2.bias",
436
+ "first_stage_model.decoder.up.1.block.1.norm2.weight": "blocks.21.norm2.weight",
437
+ "first_stage_model.decoder.up.1.block.1.time_stack.in_layers.0.bias": "blocks.22.norm1.bias",
438
+ "first_stage_model.decoder.up.1.block.1.time_stack.in_layers.0.weight": "blocks.22.norm1.weight",
439
+ "first_stage_model.decoder.up.1.block.1.time_stack.in_layers.2.bias": "blocks.22.conv1.bias",
440
+ "first_stage_model.decoder.up.1.block.1.time_stack.in_layers.2.weight": "blocks.22.conv1.weight",
441
+ "first_stage_model.decoder.up.1.block.1.time_stack.out_layers.0.bias": "blocks.22.norm2.bias",
442
+ "first_stage_model.decoder.up.1.block.1.time_stack.out_layers.0.weight": "blocks.22.norm2.weight",
443
+ "first_stage_model.decoder.up.1.block.1.time_stack.out_layers.3.bias": "blocks.22.conv2.bias",
444
+ "first_stage_model.decoder.up.1.block.1.time_stack.out_layers.3.weight": "blocks.22.conv2.weight",
445
+ "first_stage_model.decoder.up.1.block.2.conv1.bias": "blocks.23.conv1.bias",
446
+ "first_stage_model.decoder.up.1.block.2.conv1.weight": "blocks.23.conv1.weight",
447
+ "first_stage_model.decoder.up.1.block.2.conv2.bias": "blocks.23.conv2.bias",
448
+ "first_stage_model.decoder.up.1.block.2.conv2.weight": "blocks.23.conv2.weight",
449
+ "first_stage_model.decoder.up.1.block.2.mix_factor": "blocks.24.mix_factor",
450
+ "first_stage_model.decoder.up.1.block.2.norm1.bias": "blocks.23.norm1.bias",
451
+ "first_stage_model.decoder.up.1.block.2.norm1.weight": "blocks.23.norm1.weight",
452
+ "first_stage_model.decoder.up.1.block.2.norm2.bias": "blocks.23.norm2.bias",
453
+ "first_stage_model.decoder.up.1.block.2.norm2.weight": "blocks.23.norm2.weight",
454
+ "first_stage_model.decoder.up.1.block.2.time_stack.in_layers.0.bias": "blocks.24.norm1.bias",
455
+ "first_stage_model.decoder.up.1.block.2.time_stack.in_layers.0.weight": "blocks.24.norm1.weight",
456
+ "first_stage_model.decoder.up.1.block.2.time_stack.in_layers.2.bias": "blocks.24.conv1.bias",
457
+ "first_stage_model.decoder.up.1.block.2.time_stack.in_layers.2.weight": "blocks.24.conv1.weight",
458
+ "first_stage_model.decoder.up.1.block.2.time_stack.out_layers.0.bias": "blocks.24.norm2.bias",
459
+ "first_stage_model.decoder.up.1.block.2.time_stack.out_layers.0.weight": "blocks.24.norm2.weight",
460
+ "first_stage_model.decoder.up.1.block.2.time_stack.out_layers.3.bias": "blocks.24.conv2.bias",
461
+ "first_stage_model.decoder.up.1.block.2.time_stack.out_layers.3.weight": "blocks.24.conv2.weight",
462
+ "first_stage_model.decoder.up.1.upsample.conv.bias": "blocks.25.conv.bias",
463
+ "first_stage_model.decoder.up.1.upsample.conv.weight": "blocks.25.conv.weight",
464
+ "first_stage_model.decoder.up.2.block.0.conv1.bias": "blocks.12.conv1.bias",
465
+ "first_stage_model.decoder.up.2.block.0.conv1.weight": "blocks.12.conv1.weight",
466
+ "first_stage_model.decoder.up.2.block.0.conv2.bias": "blocks.12.conv2.bias",
467
+ "first_stage_model.decoder.up.2.block.0.conv2.weight": "blocks.12.conv2.weight",
468
+ "first_stage_model.decoder.up.2.block.0.mix_factor": "blocks.13.mix_factor",
469
+ "first_stage_model.decoder.up.2.block.0.norm1.bias": "blocks.12.norm1.bias",
470
+ "first_stage_model.decoder.up.2.block.0.norm1.weight": "blocks.12.norm1.weight",
471
+ "first_stage_model.decoder.up.2.block.0.norm2.bias": "blocks.12.norm2.bias",
472
+ "first_stage_model.decoder.up.2.block.0.norm2.weight": "blocks.12.norm2.weight",
473
+ "first_stage_model.decoder.up.2.block.0.time_stack.in_layers.0.bias": "blocks.13.norm1.bias",
474
+ "first_stage_model.decoder.up.2.block.0.time_stack.in_layers.0.weight": "blocks.13.norm1.weight",
475
+ "first_stage_model.decoder.up.2.block.0.time_stack.in_layers.2.bias": "blocks.13.conv1.bias",
476
+ "first_stage_model.decoder.up.2.block.0.time_stack.in_layers.2.weight": "blocks.13.conv1.weight",
477
+ "first_stage_model.decoder.up.2.block.0.time_stack.out_layers.0.bias": "blocks.13.norm2.bias",
478
+ "first_stage_model.decoder.up.2.block.0.time_stack.out_layers.0.weight": "blocks.13.norm2.weight",
479
+ "first_stage_model.decoder.up.2.block.0.time_stack.out_layers.3.bias": "blocks.13.conv2.bias",
480
+ "first_stage_model.decoder.up.2.block.0.time_stack.out_layers.3.weight": "blocks.13.conv2.weight",
481
+ "first_stage_model.decoder.up.2.block.1.conv1.bias": "blocks.14.conv1.bias",
482
+ "first_stage_model.decoder.up.2.block.1.conv1.weight": "blocks.14.conv1.weight",
483
+ "first_stage_model.decoder.up.2.block.1.conv2.bias": "blocks.14.conv2.bias",
484
+ "first_stage_model.decoder.up.2.block.1.conv2.weight": "blocks.14.conv2.weight",
485
+ "first_stage_model.decoder.up.2.block.1.mix_factor": "blocks.15.mix_factor",
486
+ "first_stage_model.decoder.up.2.block.1.norm1.bias": "blocks.14.norm1.bias",
487
+ "first_stage_model.decoder.up.2.block.1.norm1.weight": "blocks.14.norm1.weight",
488
+ "first_stage_model.decoder.up.2.block.1.norm2.bias": "blocks.14.norm2.bias",
489
+ "first_stage_model.decoder.up.2.block.1.norm2.weight": "blocks.14.norm2.weight",
490
+ "first_stage_model.decoder.up.2.block.1.time_stack.in_layers.0.bias": "blocks.15.norm1.bias",
491
+ "first_stage_model.decoder.up.2.block.1.time_stack.in_layers.0.weight": "blocks.15.norm1.weight",
492
+ "first_stage_model.decoder.up.2.block.1.time_stack.in_layers.2.bias": "blocks.15.conv1.bias",
493
+ "first_stage_model.decoder.up.2.block.1.time_stack.in_layers.2.weight": "blocks.15.conv1.weight",
494
+ "first_stage_model.decoder.up.2.block.1.time_stack.out_layers.0.bias": "blocks.15.norm2.bias",
495
+ "first_stage_model.decoder.up.2.block.1.time_stack.out_layers.0.weight": "blocks.15.norm2.weight",
496
+ "first_stage_model.decoder.up.2.block.1.time_stack.out_layers.3.bias": "blocks.15.conv2.bias",
497
+ "first_stage_model.decoder.up.2.block.1.time_stack.out_layers.3.weight": "blocks.15.conv2.weight",
498
+ "first_stage_model.decoder.up.2.block.2.conv1.bias": "blocks.16.conv1.bias",
499
+ "first_stage_model.decoder.up.2.block.2.conv1.weight": "blocks.16.conv1.weight",
500
+ "first_stage_model.decoder.up.2.block.2.conv2.bias": "blocks.16.conv2.bias",
501
+ "first_stage_model.decoder.up.2.block.2.conv2.weight": "blocks.16.conv2.weight",
502
+ "first_stage_model.decoder.up.2.block.2.mix_factor": "blocks.17.mix_factor",
503
+ "first_stage_model.decoder.up.2.block.2.norm1.bias": "blocks.16.norm1.bias",
504
+ "first_stage_model.decoder.up.2.block.2.norm1.weight": "blocks.16.norm1.weight",
505
+ "first_stage_model.decoder.up.2.block.2.norm2.bias": "blocks.16.norm2.bias",
506
+ "first_stage_model.decoder.up.2.block.2.norm2.weight": "blocks.16.norm2.weight",
507
+ "first_stage_model.decoder.up.2.block.2.time_stack.in_layers.0.bias": "blocks.17.norm1.bias",
508
+ "first_stage_model.decoder.up.2.block.2.time_stack.in_layers.0.weight": "blocks.17.norm1.weight",
509
+ "first_stage_model.decoder.up.2.block.2.time_stack.in_layers.2.bias": "blocks.17.conv1.bias",
510
+ "first_stage_model.decoder.up.2.block.2.time_stack.in_layers.2.weight": "blocks.17.conv1.weight",
511
+ "first_stage_model.decoder.up.2.block.2.time_stack.out_layers.0.bias": "blocks.17.norm2.bias",
512
+ "first_stage_model.decoder.up.2.block.2.time_stack.out_layers.0.weight": "blocks.17.norm2.weight",
513
+ "first_stage_model.decoder.up.2.block.2.time_stack.out_layers.3.bias": "blocks.17.conv2.bias",
514
+ "first_stage_model.decoder.up.2.block.2.time_stack.out_layers.3.weight": "blocks.17.conv2.weight",
515
+ "first_stage_model.decoder.up.2.upsample.conv.bias": "blocks.18.conv.bias",
516
+ "first_stage_model.decoder.up.2.upsample.conv.weight": "blocks.18.conv.weight",
517
+ "first_stage_model.decoder.up.3.block.0.conv1.bias": "blocks.5.conv1.bias",
518
+ "first_stage_model.decoder.up.3.block.0.conv1.weight": "blocks.5.conv1.weight",
519
+ "first_stage_model.decoder.up.3.block.0.conv2.bias": "blocks.5.conv2.bias",
520
+ "first_stage_model.decoder.up.3.block.0.conv2.weight": "blocks.5.conv2.weight",
521
+ "first_stage_model.decoder.up.3.block.0.mix_factor": "blocks.6.mix_factor",
522
+ "first_stage_model.decoder.up.3.block.0.norm1.bias": "blocks.5.norm1.bias",
523
+ "first_stage_model.decoder.up.3.block.0.norm1.weight": "blocks.5.norm1.weight",
524
+ "first_stage_model.decoder.up.3.block.0.norm2.bias": "blocks.5.norm2.bias",
525
+ "first_stage_model.decoder.up.3.block.0.norm2.weight": "blocks.5.norm2.weight",
526
+ "first_stage_model.decoder.up.3.block.0.time_stack.in_layers.0.bias": "blocks.6.norm1.bias",
527
+ "first_stage_model.decoder.up.3.block.0.time_stack.in_layers.0.weight": "blocks.6.norm1.weight",
528
+ "first_stage_model.decoder.up.3.block.0.time_stack.in_layers.2.bias": "blocks.6.conv1.bias",
529
+ "first_stage_model.decoder.up.3.block.0.time_stack.in_layers.2.weight": "blocks.6.conv1.weight",
530
+ "first_stage_model.decoder.up.3.block.0.time_stack.out_layers.0.bias": "blocks.6.norm2.bias",
531
+ "first_stage_model.decoder.up.3.block.0.time_stack.out_layers.0.weight": "blocks.6.norm2.weight",
532
+ "first_stage_model.decoder.up.3.block.0.time_stack.out_layers.3.bias": "blocks.6.conv2.bias",
533
+ "first_stage_model.decoder.up.3.block.0.time_stack.out_layers.3.weight": "blocks.6.conv2.weight",
534
+ "first_stage_model.decoder.up.3.block.1.conv1.bias": "blocks.7.conv1.bias",
535
+ "first_stage_model.decoder.up.3.block.1.conv1.weight": "blocks.7.conv1.weight",
536
+ "first_stage_model.decoder.up.3.block.1.conv2.bias": "blocks.7.conv2.bias",
537
+ "first_stage_model.decoder.up.3.block.1.conv2.weight": "blocks.7.conv2.weight",
538
+ "first_stage_model.decoder.up.3.block.1.mix_factor": "blocks.8.mix_factor",
539
+ "first_stage_model.decoder.up.3.block.1.norm1.bias": "blocks.7.norm1.bias",
540
+ "first_stage_model.decoder.up.3.block.1.norm1.weight": "blocks.7.norm1.weight",
541
+ "first_stage_model.decoder.up.3.block.1.norm2.bias": "blocks.7.norm2.bias",
542
+ "first_stage_model.decoder.up.3.block.1.norm2.weight": "blocks.7.norm2.weight",
543
+ "first_stage_model.decoder.up.3.block.1.time_stack.in_layers.0.bias": "blocks.8.norm1.bias",
544
+ "first_stage_model.decoder.up.3.block.1.time_stack.in_layers.0.weight": "blocks.8.norm1.weight",
545
+ "first_stage_model.decoder.up.3.block.1.time_stack.in_layers.2.bias": "blocks.8.conv1.bias",
546
+ "first_stage_model.decoder.up.3.block.1.time_stack.in_layers.2.weight": "blocks.8.conv1.weight",
547
+ "first_stage_model.decoder.up.3.block.1.time_stack.out_layers.0.bias": "blocks.8.norm2.bias",
548
+ "first_stage_model.decoder.up.3.block.1.time_stack.out_layers.0.weight": "blocks.8.norm2.weight",
549
+ "first_stage_model.decoder.up.3.block.1.time_stack.out_layers.3.bias": "blocks.8.conv2.bias",
550
+ "first_stage_model.decoder.up.3.block.1.time_stack.out_layers.3.weight": "blocks.8.conv2.weight",
551
+ "first_stage_model.decoder.up.3.block.2.conv1.bias": "blocks.9.conv1.bias",
552
+ "first_stage_model.decoder.up.3.block.2.conv1.weight": "blocks.9.conv1.weight",
553
+ "first_stage_model.decoder.up.3.block.2.conv2.bias": "blocks.9.conv2.bias",
554
+ "first_stage_model.decoder.up.3.block.2.conv2.weight": "blocks.9.conv2.weight",
555
+ "first_stage_model.decoder.up.3.block.2.mix_factor": "blocks.10.mix_factor",
556
+ "first_stage_model.decoder.up.3.block.2.norm1.bias": "blocks.9.norm1.bias",
557
+ "first_stage_model.decoder.up.3.block.2.norm1.weight": "blocks.9.norm1.weight",
558
+ "first_stage_model.decoder.up.3.block.2.norm2.bias": "blocks.9.norm2.bias",
559
+ "first_stage_model.decoder.up.3.block.2.norm2.weight": "blocks.9.norm2.weight",
560
+ "first_stage_model.decoder.up.3.block.2.time_stack.in_layers.0.bias": "blocks.10.norm1.bias",
561
+ "first_stage_model.decoder.up.3.block.2.time_stack.in_layers.0.weight": "blocks.10.norm1.weight",
562
+ "first_stage_model.decoder.up.3.block.2.time_stack.in_layers.2.bias": "blocks.10.conv1.bias",
563
+ "first_stage_model.decoder.up.3.block.2.time_stack.in_layers.2.weight": "blocks.10.conv1.weight",
564
+ "first_stage_model.decoder.up.3.block.2.time_stack.out_layers.0.bias": "blocks.10.norm2.bias",
565
+ "first_stage_model.decoder.up.3.block.2.time_stack.out_layers.0.weight": "blocks.10.norm2.weight",
566
+ "first_stage_model.decoder.up.3.block.2.time_stack.out_layers.3.bias": "blocks.10.conv2.bias",
567
+ "first_stage_model.decoder.up.3.block.2.time_stack.out_layers.3.weight": "blocks.10.conv2.weight",
568
+ "first_stage_model.decoder.up.3.upsample.conv.bias": "blocks.11.conv.bias",
569
+ "first_stage_model.decoder.up.3.upsample.conv.weight": "blocks.11.conv.weight",
570
+ }
571
+ state_dict_ = {}
572
+ for name in state_dict:
573
+ if name in rename_dict:
574
+ param = state_dict[name]
575
+ if "blocks.2.transformer_blocks.0" in rename_dict[name]:
576
+ param = param.squeeze()
577
+ state_dict_[rename_dict[name]] = param
578
+ return state_dict_