lllyasviel / IC-Light

More relighting!
Apache License 2.0
4.87k stars 329 forks source link

do you plan to release IC-Light SDXL? #79

Open mikebilly opened 1 month ago

SoonNOON commented 2 weeks ago

import torch from diffusers import StableDiffusionXLPipeline, DPMSolverMultistepScheduler

Function to create the pipeline

def create_pipeline(pipeline_type='text-to-image', scheduler=None, model_name=None): """Creates and returns a Stable Diffusion pipeline based on the specified type."""

if scheduler is None:
    scheduler = DPMSolverMultistepScheduler(
        num_train_timesteps=1000,
        beta_start=0.00085,
        beta_end=0.012,
        algorithm_type="sde-dpmsolver++",
        use_karras_sigmas=True,
        steps_offset=1
    )

if model_name == 'sdxl':
    return StableDiffusionXLPipeline.from_pretrained('stablediffusionapi/sdxl-1.0', torch_dtype=torch.float16)

common_kwargs = {
    'vae': vae,
    'text_encoder': text_encoder,
    'tokenizer': tokenizer,
    'unet': unet,
    'scheduler': scheduler,
    'safety_checker': None,
    'requires_safety_checker': False,
    'feature_extractor': None,
    'image_encoder': None
}

if pipeline_type == 'text-to-image':
    return StableDiffusionPipeline(**common_kwargs)
elif pipeline_type == 'image-to-image':
    return StableDiffusionImg2ImgPipeline(**common_kwargs)
else:
    raise ValueError(f"Unknown pipeline type: {pipeline_type}")

Creating the SDXL pipeline

sdxl_t2i_pipe = create_pipeline('text-to-image', model_name='sdxl')

mikebilly commented 2 weeks ago

@SoonNOON what is that

SoonNOON commented 2 weeks ago

Sorry, I put this by mistake. I was testing if GPT4o understood how to implement something new.