File size: 731 Bytes
63ca2a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
动态 LoRA 挂载与零时延权重融合引擎
Author: XiaoZhe (Commercial Contact: janejulius119@gmail.com / WeChat: julius119)
"""

import logging
from typing import Dict, Any

logger = logging.getLogger("VerseFlow.LoRAManager")

class DynamicLoRAManager:
    """镜头级 LoRA 动态挂载与热插拔调度器"""
    def __init__(self):
        self.active_loras: Dict[str, float] = {}

    def apply_lora(self, pipeline: Any, lora_path: str, alpha: float = 0.75):
        logger.info(f"动态挂载 LoRA 权重: {lora_path} (Alpha={alpha})")
        self.active_loras[lora_path] = alpha

    def clear_loras(self, pipeline: Any):
        logger.info("清理已挂载的 LoRA 权重...")
        self.active_loras.clear()