Generate LoRA weight key based on original weight key Args: original_key: Original weight key name Returns: LoRA weight key name
(original_key: str)
| 396 | |
| 397 | |
| 398 | def _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 | |
| 420 | def main(): |
no outgoing calls
no test coverage detected