| 149 | ModelLTXV, ModelHyVid, ModelWan, ModelSDXL, ModelSD1, ModelLumina2] |
| 150 | |
| 151 | def is_model_arch(model, state_dict): |
| 152 | # check if model is correct |
| 153 | matched = False |
| 154 | invalid = False |
| 155 | for match_list in model.keys_detect: |
| 156 | if all(key in state_dict for key in match_list): |
| 157 | matched = True |
| 158 | invalid = any(key in state_dict for key in model.keys_banned) |
| 159 | break |
| 160 | assert not invalid, "Model architecture not allowed for conversion! (i.e. reference VS diffusers format)" |
| 161 | return matched |
| 162 | |
| 163 | def detect_arch(state_dict): |
| 164 | model_arch = None |