ComfyScript icon indicating copy to clipboard operation
ComfyScript copied to clipboard

Simplify for newbies

Open aolko opened this issue 1 year ago • 4 comments
trafficstars

Please abstract/merge some of the methods for newbies.

aolko avatar Jan 01 '24 04:01 aolko

For example?

These methods are one-to-one mappings of ComfyUI nodes. If one wants some all-in-one methods, many custom node packs are available.

Chaoses-Ib avatar Jan 01 '24 08:01 Chaoses-Ib

For example all that noise, vae encoding/decoding and sampling bs can be just one node (or just one method), same for controlnets (load controlnet,apply controlnet)

aolko avatar Jan 01 '24 09:01 aolko

This can be simply done by defining functions:

def sample(model_name: CheckpointLoader.ckpt_name, pos: str, neg: str, seed: int = 0, steps: int = 20) -> Image:
    model, clip, vae = CheckpointLoaderSimple(model_name)
    latent = EmptyLatentImage(512, 512, 1)
    latent = KSampler(model, seed, steps, 8, 'euler', 'normal', CLIPTextEncode(pos, clip), CLIPTextEncode(neg, clip), latent, 1)
    return VAEDecode(latent, vae)

with Workflow():
    pos = 'beautiful scenery nature glass bottle landscape, , purple galaxy bottle,'
    neg = 'text, watermark'
    image = sample(model_name=Checkpoints.v1_5_pruned_emaonly, pos=pos, neg=neg, seed=123)
    SaveImage(image, f'test')

But I'm hesitant to introduce things like this, because they can be very personal. If a person doesn't know how to code the workflow, he can just copy someone else's workflow and use it; if he does know, he may not need these as much because they're not flexible enough.

If you are interested in this, you can create a repository and put your utility functions there. I'll add a link to it in the readme, or just make it installed by default.

Chaoses-Ib avatar Jan 01 '24 09:01 Chaoses-Ib

I might fork it if only it has a separate unified comfy core, not a bunch of scripts

aolko avatar Jan 01 '24 10:01 aolko