GithubHelp home page GithubHelp logo

comfyui-flowty-lcm's Introduction

comfyui-flowty-lcm

This is a comfyui early testing node for LCM, adapted from https://github.com/0xbitches/sd-webui-lcm

It uses the diffusers backend unfortunately and not comfy's model loading mechanism. But the intention here is just to be able to execute lcm inside comfy.

You need to use a special lcm model for this - the only available checkpoint currently is LCM_Dreamshaper_v7.

Context Node

comfyui-flowty-lcm's People

Contributors

0xbitches avatar flowtyone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

comfyui-flowty-lcm's Issues

TypeError: slice indices must be integers or None or have an __index__ method

diffuser:0.23.0 or 0.24.0.dev0 , all has errors below:
File "/data/ComfyUI/custom_nodes/ComfyUI-LCM/lcm/lcm_i2i_pipeline.py", line 304, in call
self.scheduler.set_timesteps(strength, num_inference_steps, lcm_origin_steps)
File "/data/miniconda3/envs/env-novelai/lib/python3.10/site-packages/diffusers/schedulers/scheduling_lcm.py", line 388, in set_timesteps
timesteps = lcm_origin_timesteps[::-skipping_step][:num_inference_steps]
image

Error occurred when executing LCMSampler:

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:

Path to Work

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`

Change model path to standard path

Tried your node today and the script burped based on the model directory.
Typically, we use ComfyUIs path or StableDiffusions directory..

FileNotFoundError: [Errno 2] No such file or directory: 'foo\.cache\huggingface\hub\models--SimianLuo--LCM_Dreamshaper_v7\refs\main'

Use these paths instead:

ComfyUI: foo:\ComfyUI\models\checkpoints
Auto1111: foo:\stable-diffusion-webui\models\Stable-diffusion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.