flowtyone / comfyui-flowty-lcm

LCM test nodes for comfyui
GNU General Public License v3.0
61 stars 19 forks source link

Error occurred when executing LCMSampler: #4

Open xueqing0622 opened 10 months ago

xueqing0622 commented 10 months ago

already download LCM_Dreamshaper_v7.safetensors, where should I put it to: ..\ComfyUI\models\checkpoints ..\ComfyUI\models\checkpoints\SimianLuo ..\hub\models--SimianLuo--LCM_Dreamshaper_v7\refs\main ..\hub\models--SimianLuo--LCM_Dreamshaper_v7\refs\main\\SimianLuo All these path are not work

Error occurred when executing LCMSampler:

[Errno 13] Permission denied: 'I:\sdmodel\Stable-diffusion\cp\hub\models--SimianLuo--LCM_Dreamshaper_v7\refs\main'

File "F:\ComfyUI\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "F:\ComfyUI\ComfyUI\execution.py", line 83, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "F:\ComfyUI\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) File "F:\ComfyUI\ComfyUI\custom_nodes\comfyui-flowty-lcm\nodes.py", line 43, in sample self.pipe = LatentConsistencyModelPipeline.from_pretrained( File "F:\ComfyUI\python_embeded\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 939, in from_pretrained cached_folder = cls.download( File "F:\ComfyUI\python_embeded\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1599, in download cached_folder = snapshot_download( File "F:\ComfyUI\python_embeded\lib\site-packages\huggingface_hub\utils_validators.py", line 118, in _inner_fn return fn(args, **kwargs) File "F:\ComfyUI\python_embeded\lib\site-packages\huggingface_hub_snapshot_download.py", line 169, in snapshot_download with open(ref_path) as f:

Soliver84 commented 7 months ago

image

notes.py: `from .lcm.lcm_scheduler import LCMScheduler from .lcm.lcm_pipeline import LatentConsistencyModelPipeline from os import path import time import torch import random import numpy as np from comfy.model_management import get_torch_device

MAX_SEED = np.iinfo(np.int32).max

def randomize_seed_fn(seed: int, randomize_seed: bool) -> int: if randomize_seed: seed = random.randint(0, MAX_SEED) return seed

class LCMSampler:

def __init__(self):
    self.scheduler = LCMScheduler.from_pretrained(path.join(path.dirname(__file__), "scheduler_config.json"))
    self.pipe = None

@classmethod
def INPUT_TYPES(s):
    return {"required":
                {
                "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
                "steps": ("INT", {"default": 4, "min": 1, "max": 10000}),
                "cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.5, "round": 0.01}),
                "size": ("INT", {"default": 512, "min": 512, "max": 768}),
                "num_images": ("INT", {"default": 1, "min": 1, "max": 64}),
                 "positive_prompt": ("STRING", {"multiline": True}),
                }
            }

RETURN_TYPES = ("IMAGE",)
FUNCTION = "sample"

CATEGORY = "sampling"

def sample(self, seed, steps, cfg, positive_prompt, size, num_images):
    if self.pipe is None:
        self.pipe = LatentConsistencyModelPipeline.from_pretrained(
            pretrained_model_name_or_path="C:\Matrix\Data\Models\LCM_Dreamshaper_v7",
            local_files_only=True,
            scheduler=self.scheduler`