Download src/verseflow/engine/lora_manager.py from julius119/verseflow_studio: direct link, hf CLI and curl.
- Browser
- Download file 731 Bytes
-
https://huggingface.co/julius119/verseflow_studio/resolve/main/src/verseflow/engine/lora_manager.py
- Command line
-
hf download hf://julius119/verseflow_studio/src/verseflow/engine/lora_manager.py
-
curl -L -o lora_manager.py https://huggingface.co/julius119/verseflow_studio/resolve/main/src/verseflow/engine/lora_manager.py
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() |