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

Function _generate_lora_diff_key

tools/extract/lora_extractor.py:398–417  ·  view source on GitHub ↗

Generate LoRA weight key based on original weight key Args: original_key: Original weight key name Returns: LoRA weight key name

(original_key: str)

Source from the content-addressed store, hash-verified

396
397
398def _generate_lora_diff_key(original_key: str) -> str:
399 """
400 Generate LoRA weight key based on original weight key
401
402 Args:
403 original_key: Original weight key name
404
405 Returns:
406 LoRA weight key name
407 """
408 ret_key = "diffusion_model." + original_key
409 if original_key.endswith(".weight"):
410 return ret_key.replace(".weight", ".diff")
411 elif original_key.endswith(".bias"):
412 return ret_key.replace(".bias", ".diff_b")
413 elif original_key.endswith(".modulation"):
414 return ret_key.replace(".modulation", ".diff_m")
415 else:
416 # If no matching suffix, skip
417 return "skip"
418
419
420def main():

Callers 1

extract_lora_from_diffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected