fix: cache path for diffusers repository cache

This commit is contained in:
Limitex
2025-11-09 07:51:13 +09:00
parent b29acb6534
commit 73e4c8dbda
3 changed files with 6 additions and 6 deletions
@@ -2,7 +2,6 @@ import io
import os
from typing import Any
import folder_paths # pyright: ignore[reportMissingImports]
import requests
import torch
from comfy.model_management import get_torch_device # pyright: ignore[reportMissingImports]
@@ -18,12 +17,13 @@ from omegaconf import OmegaConf
from safetensors import safe_open
from ...domain.repositories import AutoencoderRepository
from ...utils import get_cache_path
from ._cache import is_vae_cached
class DiffusersAutoencoderRepository(AutoencoderRepository):
def __init__(self) -> None:
self.cache_dir = folder_paths.get_temp_directory()
self.cache_dir = get_cache_path()
self.device = get_torch_device()
# Reference from : https://github.com/huggingface/diffusers/blob/main/scripts/convert_vae_pt_to_diffusers.py
+2 -2
View File
@@ -1,17 +1,17 @@
import os
import folder_paths # pyright: ignore[reportMissingImports]
import torch
from comfy.model_management import get_torch_device # pyright: ignore[reportMissingImports]
from diffusers import StableDiffusionPipeline
from ...domain.repositories import PipelineRepository
from ...utils import get_cache_path
from ._cache import is_pipeline_cached
class DiffusersPipelineRepository(PipelineRepository):
def __init__(self) -> None:
self.cache_dir = folder_paths.get_temp_directory()
self.cache_dir = get_cache_path()
self.device = get_torch_device()
def convert_and_save_from_single_file(self, checkpoint_path: str, dtype: torch.dtype) -> str:
+2 -2
View File
@@ -1,14 +1,14 @@
import folder_paths # pyright: ignore[reportMissingImports]
import torch
from diffusers.schedulers.scheduling_utils import SchedulerMixin
from ...domain.model import Scheduler
from ...domain.repositories import SchedulerRepository
from ...utils import get_cache_path
class DiffusersSchedulerRepository(SchedulerRepository):
def __init__(self) -> None:
self.cache_dir = folder_paths.get_temp_directory()
self.cache_dir = get_cache_path()
def create_scheduler(
self, model_path: str, dtype: torch.dtype, scheduler_type: Scheduler.Type