@@ -1593,18 +1593,9 @@ def create_diffusers_clip_model_from_ldm(
15931593 raise ValueError ("The provided checkpoint does not seem to contain a valid CLIP model." )
15941594
15951595 if is_accelerate_available ():
1596- unexpected_keys = load_model_dict_into_meta (model , diffusers_format_checkpoint , dtype = torch_dtype )
1596+ load_model_dict_into_meta (model , diffusers_format_checkpoint , dtype = torch_dtype )
15971597 else :
1598- _ , unexpected_keys = model .load_state_dict (diffusers_format_checkpoint , strict = False )
1599-
1600- if model ._keys_to_ignore_on_load_unexpected is not None :
1601- for pat in model ._keys_to_ignore_on_load_unexpected :
1602- unexpected_keys = [k for k in unexpected_keys if re .search (pat , k ) is None ]
1603-
1604- if len (unexpected_keys ) > 0 :
1605- logger .warning (
1606- f"Some weights of the model checkpoint were not used when initializing { cls .__name__ } : \n { [', ' .join (unexpected_keys )]} "
1607- )
1598+ model .load_state_dict (diffusers_format_checkpoint , strict = False )
16081599
16091600 if torch_dtype is not None :
16101601 model .to (torch_dtype )
@@ -2061,16 +2052,7 @@ def create_diffusers_t5_model_from_checkpoint(
20612052 diffusers_format_checkpoint = convert_sd3_t5_checkpoint_to_diffusers (checkpoint )
20622053
20632054 if is_accelerate_available ():
2064- unexpected_keys = load_model_dict_into_meta (model , diffusers_format_checkpoint , dtype = torch_dtype )
2065- if model ._keys_to_ignore_on_load_unexpected is not None :
2066- for pat in model ._keys_to_ignore_on_load_unexpected :
2067- unexpected_keys = [k for k in unexpected_keys if re .search (pat , k ) is None ]
2068-
2069- if len (unexpected_keys ) > 0 :
2070- logger .warning (
2071- f"Some weights of the model checkpoint were not used when initializing { cls .__name__ } : \n { [', ' .join (unexpected_keys )]} "
2072- )
2073-
2055+ load_model_dict_into_meta (model , diffusers_format_checkpoint , dtype = torch_dtype )
20742056 else :
20752057 model .load_state_dict (diffusers_format_checkpoint )
20762058
0 commit comments