G-U-N/Gen-L-Video

unknown mid_block_type : UNetMidBlock2DCrossAttn

Closed this issue · 1 comments

First run after installing, downloading weights, modifying configs etc.

Traceback (most recent call last):
  File "D:\Gen-L-Video\one-shot-tuning.py", line 522, in <module>
    main(**conf)
  File "D:\Gen-L-Video\one-shot-tuning.py", line 128, in main
    unet = UNet3DConditionModel.from_pretrained_2d(pretrained_model_path, subfolder="unet")
  File "D:\Gen-L-Video\glv\models\unet.py", line 505, in from_pretrained_2d
    model = cls.from_config(config)
  File "D:\Gen-L-Video\voc_genlvideo\lib\site-packages\diffusers\configuration_utils.py", line 229, in from_config
    model = cls(**init_dict)
  File "D:\Gen-L-Video\voc_genlvideo\lib\site-packages\diffusers\configuration_utils.py", line 607, in inner_init
    init(self, *args, **init_kwargs)
  File "D:\Gen-L-Video\glv\models\unet.py", line 162, in __init__
    raise ValueError(f"unknown mid_block_type : {mid_block_type}")
ValueError: unknown mid_block_type : UNetMidBlock2DCrossAttn

Any ideas how to get past this one?

G-U-N commented

Thanks for reporting this.

  1. The most direct way is to delete the line of "mid_block_type" in the config.json file in the folder unet of your downloaded weight.
  2. A better way to solve this is to add the following line
config["mid_block_type"] == "UNetMidBlock3DCrossAttn"

in the function from_pretrained_2d.

I may update the code later.