Coder Social home page Coder Social logo

comfyui-ic-light-native's Introduction

ComfyUI-IC-Light-Native

ComfyUI native implementation of IC-Light.

Install

Download the repository and unpack into the custom_nodes folder in the ComfyUI installation directory.

Or clone via GIT, starting from ComfyUI installation directory:

cd custom_nodes
git clone [email protected]:huchenlei/ComfyUI-IC-Light.git

Download models

IC-Light main repo is based on diffusers. In order to load it with UnetLoader in ComfyUI, state_dict keys need to convert to ldm format. You can download models with ldm keys here: https://huggingface.co/huchenlei/IC-Light-ldm/tree/main

There are 2 models:

  • iclight_sd15_fc_unet_ldm: Use this in FG workflows
  • iclight_sd15_fbc_unet_ldm: Use this in BG workflows

After you download these models, please put them under ComfyUI/models/unet and load them with UNETLoader node.

[Important!] Required nodes

You MUST install following nodes first for IC light to work properly.

  • ComfyUI-layerdiffuse: Although not used in the workflow, the patching of weight load in layerdiffuse is a dependency for IC-Light nodes to work properly.

Recommended nodes

  • ComfyUI-KJNodes: Provides various mask nodes to create light map.
  • ComfyUI-Easy-Use: A giant node pack of everything. The remove bg node used in workflow comes from this pack.
  • ComfyUI_essentials: Many useful tooling nodes. Image resize node used in the workflow comes from this pack.

Workflows

Please make sure the fg image's masked/transparent area are grey before you pass it to the VAE. Otherwise, you will get background obscured in FC workflows or darkened background in FBC workflows. You can use IC Light Apply Mask Grey to make sure the masked area's color is correct. See following examples: 12 05 2024_16 22 48_REC 12 05 2024_16 19 02_REC

image

Light from right image

Light from left image

image

Common Issues

IC-Light's unet is accepting extra inputs on top of the common noise input. FG model accepts extra 1 input (4 channels). BG model accepts 2 extra input (8 channels). The original unet's input is 4 channels as well.

If you see following issue, it means IC-Light's unet is not properly loaded, and you need to install ComfyUI-layerdiffuse first.

RuntimeError: Given groups=1, weight of size [320, 4, 3, 3], expected input[2, 8, 64, 64] to have 4 channels, but got 8 channels instead

If you see following error, it means you are using FG workflow but loaded the BG model.

RuntimeError: Given groups=1, weight of size [320, 8, 3, 3], expected input[2, 12, 64, 64] to have 8 channels, but got 12 channels instead

If you see following error, it means you are using FG workflow but loaded the BG model.

RuntimeError: Given groups=1, weight of size [320, 12, 3, 3], expected input[2, 8, 64, 64] to have 12 channels, but got 8 channels instead

comfyui-ic-light-native's People

Contributors

huchenlei avatar

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.