Tutorials

How to Use Local LLM on ComfyUI to Generate Perfect Prompts and Images

0
Please log in or register to do it.

Although I have some complaints about ComfyUI’s processing speed and the images it generates, it’s a lot of fun to connect the lines to do whatever you want in succession.

Is it like a Pythagoras switch?

Thanks to trying out various things, I’ve gotten a bit used to installing custom nodes, so I want to try something more.

Local LLMs are becoming more and more accessible, so we tried to use this to collaborate.

We will proceed assuming that ollama is installed.

Add ComfyUI-IF_AI_tools.

https://github.com/if-ai/ComfyUI-IF_AI_tools

There are instructions in the Installation section of this GitHub page, so follow those instructions.

image

Installation Instructions

1. From ComfyUI manager, search for IF_AI and install ComfyUI-IF_AI_tools.

2. Add the LLM model. I added impactframes/ifai_promptmkr_dolphin_phi3:latest.

ollama run impactframes/ifai_promptmkr_dolphin_phi3:latest

Of course, this is fine too.

ollama run impactframes/llama3_ifai_sd_prompt_mkr_q4km:latest

3. Copy the “IF_AI” ​​folder from the ComfyUI-IF_AI_tools/ folder to the ComfyUI/input/ folder.

4. Install additional software. Go to the ComfyUI-IF_AI_tools/ folder and launch the terminal. Execute the following command.

python -m pip install -r requirements.txt

You’re all set.

Now, let’s start with using ComfyUI.

First, just check whether you can create a good prompt just by entering a keyword.

Once you launch ComfyUI, press Clear to delete all nodes.

Double-click in an empty space and search for “IF”.

You will then find “IF Chat Prompt” and add it.

image
image

The engine is ollama and the model is impactframes/ifai_promptmkr_dolphin_phi3:latest. I have a feeling that ollama will work properly.

To monitor the output text, add “IF Display Text” and connect Response and text with a line.

image

Select an assistant.

image

I tried selecting “IF_PromptMKR_IMG2”. For some reason.

Now it’s complete. Enter some words and generate a prompt.

Just like always

1girl, bikini armor

Now click on Queue Prompt to run it.

image

The resulting prompt was:

: 1girl, futuristic armor suit, metallic finish, LED lights, high-tech helmet, advanced weaponry, urban landscape, neon signs, hovercrafts, cyberpunk ambiance, vivid colors, cinematic lighting, ultra HD resolution, 8K.

Oh, it’s working properly.

Now let’s connect this to the default workflow and generate some images.

Clear it once, open the workflow by Load Default, and add nodes.

image

To play the generated prompt in the positive prompt, right-click Clip Text Encode(Prompt) and select Convert Widget To Input > Convert text to input.

image

The input field will now disappear and text will appear in the input.

image

Connect the STRING output of IF Display Text to the text of this input.

image
Workflow complete

Let’s give it a try. Model is GhostXL, sampler is DPM++2m karras, size is 1024×1024.

Word to be specified

Girl in bikini armor

Generated prompt

: 1.5, Girl, Bikini Armor, Futuristic, Spacecraft, Starry Night Sky, Glowing Stars, Cosmic Energy, Neon Colors, High-tech Design, Adventure Seeker, Exploring Uncharted Territories, Mystical Landscapes, Alien Encounters, Sci-Fi Elements, Imaginative Artistry , Ultra HD, 8K, Intricate Details, Vivid Colors, Cinematic Lighting, Captivating Composition, Extremely High Quality

image

The prompts are quite interesting as they are ones I would never have thought of myself.

once again.

Generated prompt

Splashy, vivid colors, bright sunlight, scene beach, palm trees, crystal clear water, seagulls flying overhead, tropical island ambiance, relaxed pose, carefree smile, sunglasses, Hawaiian lei necklace, flowing hair, bikini armor, surfboard underarm, ocean waves crashing nearby, sandy beach, golden hour lighting, Instagram worthy photo op, 8K resolution, Perfect clarity

image
It’s no longer armor.

I went to Hawaii. Why?

At the very least, try adding fantasy as the first word.

Generated prompt

: 1.5, magical forest setting, ethereal lighting, fairy wings, enchanted flora, mystical creatures, whimsical atmosphere, surreal landscapes, dreamlike ambiance, soft pastel colors, airbrushed texture, digital artistry, imaginative composition, otherworldly beauty.

image
Just a fantasy

Even 1girl is gone. Hmm.

once again.

: Girl, Bikini Armor, Fantasy Landscape, Enchanted Forest, Mystical Creatures, Fairy Light, Whimsical Colors, Dreamlike Atmosphere, Magic Spells, Fairies, Unicorns, Mushrooms, Flowers, Butterflies, Birds, Rainbow Sky, Sunbeams, Soft Shadows, 8K, Vivid Colors, Highest Quality

image
I see, that’s how it is.

1girl is back, but it's too fantasy-like.

Let’s change the words a bit.

a girl, bikini armor, silver long hair, bule eyes

Generated prompt

: 1.8, captivating, ethereal beauty, mystical forest setting, moonlight filtering through trees, delicate fairy wings fluttering around her head, radiant smile, otherworldly charm, enchanting ambiance, dreamlike, surrealism, soft pastel hues, airbrushed details, 8K resolution.

image
Hmm.

Well, since Prompto is a gacha, I guess that’s about it.

Well, I guess I achieved my goal. That’s all for today.

ComfyUI Master Guide: How to Start Image-to-Image with ComfyUI
AI Youtube Shorts Generator", "forge-space-ollama", and others

Your email address will not be published. Required fields are marked *