fix: lcm lora type

This commit is contained in:
Limitex
2025-11-24 00:11:41 +09:00
parent 06c9f21ffb
commit 02dc9bbcbd
4 changed files with 12 additions and 9 deletions
+3 -2
View File
@@ -1,12 +1,13 @@
from dataclasses import dataclass
from typing import Any
import torch
@dataclass(frozen=True)
class LcmLora:
"""LCM LoRA weights for Stream Diffusion."""
weights: dict[str, Any]
weights: dict[str, torch.Tensor]
def __post_init__(self) -> None:
if not isinstance(self.weights, dict):
@@ -1,10 +1,11 @@
from abc import ABC, abstractmethod
from typing import Any
import torch
class LcmLoraRepository(ABC):
@abstractmethod
def load_lcm_lora(self, lora_path: str) -> dict[str, Any]:
def load_lcm_lora(self, lora_path: str) -> dict[str, torch.Tensor]:
"""Load LCM LoRA weights from file.
Args:
+2 -3
View File
@@ -1,12 +1,11 @@
from typing import Any
import torch
from safetensors.torch import load_file
from ...domain.repositories import LcmLoraRepository
class DiffusersLcmLoraRepository(LcmLoraRepository):
def load_lcm_lora(self, lora_path: str) -> dict[str, Any]:
def load_lcm_lora(self, lora_path: str) -> dict[str, torch.Tensor]:
"""Load LCM LoRA weights from safetensors file.
Args:
+4 -2
View File
@@ -1,5 +1,7 @@
from dataclasses import dataclass
from typing import Any, ClassVar
from typing import ClassVar
import torch
from ...domain.model import LcmLora
@@ -17,7 +19,7 @@ class ComfyUILcmLoraDTO:
COMFY_TYPE: ClassVar[str] = "DIFFUSERS_LCM_LORA"
weights: dict[str, Any]
weights: dict[str, torch.Tensor]
@classmethod
def from_domain(cls, lcm_lora: LcmLora) -> "ComfyUILcmLoraDTO":