| 361 | |
| 362 | |
| 363 | class CogVAEEncoderStateDictConverter: |
| 364 | def __init__(self): |
| 365 | pass |
| 366 | |
| 367 | |
| 368 | def from_diffusers(self, state_dict): |
| 369 | rename_dict = { |
| 370 | "encoder.conv_in.conv.weight": "conv_in.weight", |
| 371 | "encoder.conv_in.conv.bias": "conv_in.bias", |
| 372 | "encoder.down_blocks.0.downsamplers.0.conv.weight": "blocks.3.conv.weight", |
| 373 | "encoder.down_blocks.0.downsamplers.0.conv.bias": "blocks.3.conv.bias", |
| 374 | "encoder.down_blocks.1.downsamplers.0.conv.weight": "blocks.7.conv.weight", |
| 375 | "encoder.down_blocks.1.downsamplers.0.conv.bias": "blocks.7.conv.bias", |
| 376 | "encoder.down_blocks.2.downsamplers.0.conv.weight": "blocks.11.conv.weight", |
| 377 | "encoder.down_blocks.2.downsamplers.0.conv.bias": "blocks.11.conv.bias", |
| 378 | "encoder.norm_out.weight": "norm_out.weight", |
| 379 | "encoder.norm_out.bias": "norm_out.bias", |
| 380 | "encoder.conv_out.conv.weight": "conv_out.weight", |
| 381 | "encoder.conv_out.conv.bias": "conv_out.bias", |
| 382 | } |
| 383 | prefix_dict = { |
| 384 | "encoder.down_blocks.0.resnets.0.": "blocks.0.", |
| 385 | "encoder.down_blocks.0.resnets.1.": "blocks.1.", |
| 386 | "encoder.down_blocks.0.resnets.2.": "blocks.2.", |
| 387 | "encoder.down_blocks.1.resnets.0.": "blocks.4.", |
| 388 | "encoder.down_blocks.1.resnets.1.": "blocks.5.", |
| 389 | "encoder.down_blocks.1.resnets.2.": "blocks.6.", |
| 390 | "encoder.down_blocks.2.resnets.0.": "blocks.8.", |
| 391 | "encoder.down_blocks.2.resnets.1.": "blocks.9.", |
| 392 | "encoder.down_blocks.2.resnets.2.": "blocks.10.", |
| 393 | "encoder.down_blocks.3.resnets.0.": "blocks.12.", |
| 394 | "encoder.down_blocks.3.resnets.1.": "blocks.13.", |
| 395 | "encoder.down_blocks.3.resnets.2.": "blocks.14.", |
| 396 | "encoder.mid_block.resnets.0.": "blocks.15.", |
| 397 | "encoder.mid_block.resnets.1.": "blocks.16.", |
| 398 | } |
| 399 | suffix_dict = { |
| 400 | "norm1.norm_layer.weight": "norm1.norm_layer.weight", |
| 401 | "norm1.norm_layer.bias": "norm1.norm_layer.bias", |
| 402 | "norm1.conv_y.conv.weight": "norm1.conv_y.weight", |
| 403 | "norm1.conv_y.conv.bias": "norm1.conv_y.bias", |
| 404 | "norm1.conv_b.conv.weight": "norm1.conv_b.weight", |
| 405 | "norm1.conv_b.conv.bias": "norm1.conv_b.bias", |
| 406 | "norm2.norm_layer.weight": "norm2.norm_layer.weight", |
| 407 | "norm2.norm_layer.bias": "norm2.norm_layer.bias", |
| 408 | "norm2.conv_y.conv.weight": "norm2.conv_y.weight", |
| 409 | "norm2.conv_y.conv.bias": "norm2.conv_y.bias", |
| 410 | "norm2.conv_b.conv.weight": "norm2.conv_b.weight", |
| 411 | "norm2.conv_b.conv.bias": "norm2.conv_b.bias", |
| 412 | "conv1.conv.weight": "conv1.weight", |
| 413 | "conv1.conv.bias": "conv1.bias", |
| 414 | "conv2.conv.weight": "conv2.weight", |
| 415 | "conv2.conv.bias": "conv2.bias", |
| 416 | "conv_shortcut.weight": "conv_shortcut.weight", |
| 417 | "conv_shortcut.bias": "conv_shortcut.bias", |
| 418 | "norm1.weight": "norm1.weight", |
| 419 | "norm1.bias": "norm1.bias", |
| 420 | "norm2.weight": "norm2.weight", |
no outgoing calls
no test coverage detected