flowtyone / comfyui-flowty-lcm

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

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

Open lilyzlt opened 11 months ago

lilyzlt commented 11 months ago

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

flowtyone commented 11 months ago

Please use native comfyui lcm support. You can find more information here: https://app.flowt.ai/c/DNYqq4

Soliver84 commented 9 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`