verseflow_studio / src /verseflow /engine /lora_manager.py
julius119's picture
Upload folder using huggingface_hub
8ab53f1 verified
Raw History Blame Contribute Delete
731 Bytes
"""
动态 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()