fix: lcm lora type
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user