Ensure that model probe does not crash with integer state dict keys.

This commit is contained in:
Ryan Dick
2024-12-17 03:28:23 +00:00
committed by Kent Keirsey
parent 440185cc40
commit 7da90a9b6b

View File

@@ -24,7 +24,7 @@ def is_state_dict_likely_flux_control(state_dict: Dict[str, Any]) -> bool:
perfect-precision detector would require checking all keys against a whitelist and verifying tensor shapes.)
"""
all_keys_match = all(re.match(FLUX_CONTROL_TRANSFORMER_KEY_REGEX, k) for k in state_dict.keys())
all_keys_match = all(re.match(FLUX_CONTROL_TRANSFORMER_KEY_REGEX, str(k)) for k in state_dict.keys())
# Check the shape of the img_in weight, because this layer shape is modified by FLUX control LoRAs.
lora_a_weight = state_dict.get("img_in.lora_A.weight", None)