37
37
from invokeai .backend .model_manager .config import (
38
38
AnyModelConfig ,
39
39
CheckpointConfigBase ,
40
- CLIPEmbedDiffusersConfig ,
41
- ControlNetCheckpointConfig ,
42
- ControlNetDiffusersConfig ,
43
- FLUX_Quantized_BnB_NF4_CheckpointConfig ,
44
- FLUX_Quantized_GGUF_CheckpointConfig ,
45
- FLUX_Unquantized_CheckpointConfig ,
46
- FluxReduxConfig ,
47
- IPAdapterCheckpointConfig ,
48
- T5EncoderBnbQuantizedLlmInt8bConfig ,
49
- T5EncoderConfig ,
50
- VAECheckpointConfig ,
40
+ CLIPEmbed_Diffusers_Config_Base ,
41
+ ControlNet_Checkpoint_Config_Base ,
42
+ ControlNet_Diffusers_Config_Base ,
43
+ FLUXRedux_Checkpoint_Config ,
44
+ IPAdapter_Checkpoint_Config_Base ,
45
+ Main_FLUX_BnBNF4_Config ,
46
+ Main_FLUX_Checkpoint_Config ,
47
+ Main_FLUX_GGUF_Config ,
48
+ T5Encoder_BnBLLMint8_Config ,
49
+ T5Encoder_T5Encoder_Config ,
50
+ VAE_Checkpoint_Config_Base ,
51
51
)
52
52
from invokeai .backend .model_manager .load .load_default import ModelLoader
53
53
from invokeai .backend .model_manager .load .model_loader_registry import ModelLoaderRegistry
54
54
from invokeai .backend .model_manager .taxonomy import (
55
55
AnyModel ,
56
56
BaseModelType ,
57
+ FluxVariantType ,
57
58
ModelFormat ,
58
59
ModelType ,
59
- ModelVariantType ,
60
60
SubModelType ,
61
61
)
62
62
from invokeai .backend .model_manager .util .model_util import (
@@ -86,7 +86,7 @@ def _load_model(
86
86
config : AnyModelConfig ,
87
87
submodel_type : Optional [SubModelType ] = None ,
88
88
) -> AnyModel :
89
- if not isinstance (config , VAECheckpointConfig ):
89
+ if not isinstance (config , VAE_Checkpoint_Config_Base ):
90
90
raise ValueError ("Only VAECheckpointConfig models are currently supported here." )
91
91
model_path = Path (config .path )
92
92
@@ -116,7 +116,7 @@ def _load_model(
116
116
config : AnyModelConfig ,
117
117
submodel_type : Optional [SubModelType ] = None ,
118
118
) -> AnyModel :
119
- if not isinstance (config , CLIPEmbedDiffusersConfig ):
119
+ if not isinstance (config , CLIPEmbed_Diffusers_Config_Base ):
120
120
raise ValueError ("Only CLIPEmbedDiffusersConfig models are currently supported here." )
121
121
122
122
match submodel_type :
@@ -139,7 +139,7 @@ def _load_model(
139
139
config : AnyModelConfig ,
140
140
submodel_type : Optional [SubModelType ] = None ,
141
141
) -> AnyModel :
142
- if not isinstance (config , T5EncoderBnbQuantizedLlmInt8bConfig ):
142
+ if not isinstance (config , T5Encoder_BnBLLMint8_Config ):
143
143
raise ValueError ("Only T5EncoderBnbQuantizedLlmInt8bConfig models are currently supported here." )
144
144
if not bnb_available :
145
145
raise ImportError (
@@ -186,7 +186,7 @@ def _load_model(
186
186
config : AnyModelConfig ,
187
187
submodel_type : Optional [SubModelType ] = None ,
188
188
) -> AnyModel :
189
- if not isinstance (config , T5EncoderConfig ):
189
+ if not isinstance (config , T5Encoder_T5Encoder_Config ):
190
190
raise ValueError ("Only T5EncoderConfig models are currently supported here." )
191
191
192
192
match submodel_type :
@@ -226,7 +226,7 @@ def _load_from_singlefile(
226
226
self ,
227
227
config : AnyModelConfig ,
228
228
) -> AnyModel :
229
- assert isinstance (config , FLUX_Unquantized_CheckpointConfig )
229
+ assert isinstance (config , Main_FLUX_Checkpoint_Config )
230
230
model_path = Path (config .path )
231
231
232
232
with accelerate .init_empty_weights ():
@@ -268,7 +268,7 @@ def _load_from_singlefile(
268
268
self ,
269
269
config : AnyModelConfig ,
270
270
) -> AnyModel :
271
- assert isinstance (config , FLUX_Quantized_GGUF_CheckpointConfig )
271
+ assert isinstance (config , Main_FLUX_GGUF_Config )
272
272
model_path = Path (config .path )
273
273
274
274
with accelerate .init_empty_weights ():
@@ -314,7 +314,7 @@ def _load_from_singlefile(
314
314
self ,
315
315
config : AnyModelConfig ,
316
316
) -> AnyModel :
317
- assert isinstance (config , FLUX_Quantized_BnB_NF4_CheckpointConfig )
317
+ assert isinstance (config , Main_FLUX_BnBNF4_Config )
318
318
if not bnb_available :
319
319
raise ImportError (
320
320
"The bnb modules are not available. Please install bitsandbytes if available on your platform."
@@ -342,9 +342,9 @@ def _load_model(
342
342
config : AnyModelConfig ,
343
343
submodel_type : Optional [SubModelType ] = None ,
344
344
) -> AnyModel :
345
- if isinstance (config , ControlNetCheckpointConfig ):
345
+ if isinstance (config , ControlNet_Checkpoint_Config_Base ):
346
346
model_path = Path (config .path )
347
- elif isinstance (config , ControlNetDiffusersConfig ):
347
+ elif isinstance (config , ControlNet_Diffusers_Config_Base ):
348
348
# If this is a diffusers directory, we simply ignore the config file and load from the weight file.
349
349
model_path = Path (config .path ) / "diffusion_pytorch_model.safetensors"
350
350
else :
@@ -363,7 +363,7 @@ def _load_model(
363
363
def _load_xlabs_controlnet (self , sd : dict [str , torch .Tensor ]) -> AnyModel :
364
364
with accelerate .init_empty_weights ():
365
365
# HACK(ryand): Is it safe to assume dev here?
366
- model = XLabsControlNetFlux (get_flux_transformers_params (ModelVariantType . FluxDev ))
366
+ model = XLabsControlNetFlux (get_flux_transformers_params (FluxVariantType . Dev ))
367
367
368
368
model .load_state_dict (sd , assign = True )
369
369
return model
@@ -389,7 +389,7 @@ def _load_model(
389
389
config : AnyModelConfig ,
390
390
submodel_type : Optional [SubModelType ] = None ,
391
391
) -> AnyModel :
392
- if not isinstance (config , IPAdapterCheckpointConfig ):
392
+ if not isinstance (config , IPAdapter_Checkpoint_Config_Base ):
393
393
raise ValueError (f"Unexpected model config type: { type (config )} ." )
394
394
395
395
sd = load_file (Path (config .path ))
@@ -412,7 +412,7 @@ def _load_model(
412
412
config : AnyModelConfig ,
413
413
submodel_type : Optional [SubModelType ] = None ,
414
414
) -> AnyModel :
415
- if not isinstance (config , FluxReduxConfig ):
415
+ if not isinstance (config , FLUXRedux_Checkpoint_Config ):
416
416
raise ValueError (f"Unexpected model config type: { type (config )} ." )
417
417
418
418
sd = load_file (Path (config .path ))
0 commit comments