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

Function main

tools/extract/lora_extractor.py:420–452  ·  view source on GitHub ↗

Main function

()

Source from the content-addressed store, hash-verified

418
419
420def main():
421 """Main function"""
422 args = parse_args()
423
424 print("=" * 50)
425 print("LoRA Extractor Started")
426 print("=" * 50)
427 print(f"Source model: {args.source_model} ({args.source_type})")
428 print(f"Target model: {args.target_model} ({args.target_type})")
429 print(f"Output path: {args.output} ({args.output_format})")
430 print(f"Output data type: {args.output_dtype}")
431 print(f"LoRA parameters: rank={args.rank}")
432 print(f"Diff only mode: {args.diff_only}")
433 print("=" * 50)
434
435 try:
436 # Load source and target models
437 source_weights = load_model_weights(args.source_model, args.source_type)
438 target_weights = load_model_weights(args.target_model, args.target_type)
439
440 # Extract LoRA weights
441 lora_weights = extract_lora_from_diff(source_weights, target_weights, rank=args.rank, diff_only=args.diff_only)
442
443 # Save LoRA weights
444 save_lora_weights(lora_weights, args.output, args.output_format, args.output_dtype)
445
446 print("=" * 50)
447 print("LoRA extraction completed!")
448 print("=" * 50)
449
450 except Exception as e:
451 print(f"Error: {e}")
452 raise
453
454
455if __name__ == "__main__":

Callers 1

lora_extractor.pyFile · 0.70

Calls 4

extract_lora_from_diffFunction · 0.85
parse_argsFunction · 0.70
load_model_weightsFunction · 0.70
save_lora_weightsFunction · 0.70

Tested by

no test coverage detected