MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / detect_format

Method detect_format

lightx2v/utils/lora_loader.py:111–125  ·  view source on GitHub ↗

Detect the LoRA format of a given key. Args: key: The weight key to check lora_weights: The full LoRA weights dictionary Returns: Tuple of (LoRAFormat, detected_suffix) if format detected, None otherwise

(self, key: str, lora_weights: Dict)

Source from the content-addressed store, hash-verified

109 }
110
111 def detect_format(self, key: str, lora_weights: Dict) -> Optional[Tuple[LoRAFormat, str]]:
112 """
113 Detect the LoRA format of a given key.
114
115 Args:
116 key: The weight key to check
117 lora_weights: The full LoRA weights dictionary
118
119 Returns:
120 Tuple of (LoRAFormat, detected_suffix) if format detected, None otherwise
121 """
122 for format_type, pattern in self.patterns.items():
123 if key.endswith(pattern.up_suffix):
124 return (format_type, pattern.up_suffix)
125 return None
126
127 def extract_lora_pair(
128 self,

Callers 1

extract_lora_pairMethod · 0.95

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected