Enhancing Prompts with Llama 3 to Generate High Quality Photo
With Automatic1111/ Forge and ComfyUI extensions
![Enhancing Prompts with Llama 3 to Generate High Quality Photo](https://substackcdn.com/image/fetch/w_474,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f16a8b-5e8a-4ef0-86e8-2e01495a37a2_1024x1024.png)
![Enhancing Prompts with Llama 3 to Generate High Quality Photo](https://substackcdn.com/image/fetch/w_474,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11221be1-3d71-4b93-9fd2-4ada576018fb_1024x1024.png)
![Enhancing Prompts with Llama 3 to Generate High Quality Photo](https://substackcdn.com/image/fetch/w_474,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d87a8a0-5721-4784-9e10-aae29d9692c2_1024x1024.png)
Llama 3 has sparked a wave of applications aimed at enriching user prompts. Popular AI generative tools like ComfyUI and Automatic1111/Forge now integrate Llama 3 seamlessly. It making prompt enhancement accessible without complex maneuvers thanks to accompanying extensions.
What is Llama 3?
Llama 3, a large language model (LLM) from Meta. It is available for free commercial use under specific conditions (up to 700 million monthly requests). With versions ranging from 8B to 400B, Meta Llama 3 surpasses comparable models like Google’s Gemma/Gemini, Mistral, and Claude 3 Sonnet, boasting efficient operation on a 4GB GPU.
![Comparing Meta Llama 3 with other Models. (Image from Meta) Comparing Meta Llama 3 with other Models. (Image from Meta)](https://substackcdn.com/image/fetch/w_2400,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd08fa9ad-da49-44fd-a00c-012483ba83fe_1200x675.png)
Installing Ollama
Ollama serves as a facilitator for installing Llama 3. You can download the version compatible with your operating system from the link below.
Download Ollama
Get up and running with large language models.ollama.com
Download Model
After launching Ollama, execute the command in Terminal to download llama3_ifai_sd_prompt_mkr_q4km
. Which occupies approximately 4.9GB of storage.
ollama run impactframes/llama3_ifai_sd_prompt_mkr_q4km
This model combines Llama 3 with 5000 high-quality Stable Diffusion Prompts to ensure superior prompt performance and quality.
You can engage in dialogue with Llama 3 upon download completion. It designed specifically for prompts. If I input 1girl
to Llama 3, it will describes the prompt meticulously and providing detailed insights into the concept of 1girl
.
Prompts: Adorable, energetic young girl, bright smile, curly brown hair, standing alone in a lush green forest glade, wearing vibrant flower garland around her neck, looking directly at the viewer with sparkling eyes, surrounded by blooming wildflowers, sunlight filtering through trees above.
Installing Extensions
Manually copying prompts each time is impractical, follow the guide for install ComfyUI node and Automatic1111 StableDiffusionWebUI/Forge extension to simplify Llama 3 usage.
Automatic1111 StableDiffusion WebUI/Forge Extension
Both WebUI and Forge versions share the same extension and installation process, as detailed below.
Navigate to Extensions
> Available
and click Load from
, then search for IF_prompt_MKR
to find and install it.
Settings of extension
After installation, go to
Settings
>Uncategorized
>iF_prompt_MKR
and set Select the API for generating prompts toOllama
.
then in the Script section, select
iF_prompt_MKR
.In the Text Model, choose Characters as
iF_prompt_MKR
Select Text-Model as
impactframes/llama3_ifai_sd_prompt_mkr_q4km:latest
.You can enter a simple prompt in the input prompt field.
Note that enabling extension will replaces the original prompt box with prompts generated by
iF_prompt_MKR
.
Under Styling (Optional), customize and style prompts. Selected styles will display prompts for immediate modification.
In Prefix & Embeddings and Suffix & Loras select embeddings Models and Lora Models if desired. Although these are optional.
Choosing a Negative Prompt will display options in text field. I opted for simple_negative
.
I used Juggernaut XL Lightning as the Checkpoint Model. Please adjust steps and CFG scale if not using Lightning or Turbo Model.
When using this extension, Terminal offers prompts guidelines and suggestions for reference.
Comparative Testing 1
In iF_prompt_MKR Text Model, input girl, blue sky background
as prompts. Styling choices were Epic
and Photographic
, with simple_negative
as the Negative Prompt.
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4ca29b4-547e-4de3-967f-5f688eff9589_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48dbba96-6b76-44b6-b653-97c5ed4515b2_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dc0afbf-2abf-42dc-9cb6-5423e9938418_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F126dca39-6946-4f4f-80b4-bd0ac867e5fd_1024x1024.png)
Generating images with same prompts without Llama 3 support.
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff240fbdb-49a6-4695-8cea-7bad6743d5f3_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91c89c54-a3e0-48ae-8828-cb88731f32b9_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e441e7d-1f7f-4436-a053-9b20c1005945_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec133d5d-47c9-44e7-a782-ab197cc638ba_1024x1024.png)
While both sets depict a girl against a blue sky background, the images generated with Llama 3 prompts are richer detail and background context. Llama 3 significantly enhances prompts, particularly when original prompts lack specificity.
ComfyUI Nodes
After installing Ollama, use ComfyUI Manager to search for ComfyUI-IF_AI_tools and install it.
And download workflow in following link:
Using Llama 3 generate Prompt for ComfyUI
This is a ComfyUI workflow for using Llama 3 to generate prompt, it also provide a workflow to generate two different…edmondyip.gumroad.com
I configured it to compare regular prompts with Llama 3 enhanced prompts. In the IF Prompt to Prompt section, I usedtoy cat
as the prompt.
I selected Juggernaut XL Lightning as checkpoint model, adjusting
steps
andcfg
if not using the Lightning Model.Styling embellish prompt set to
Epic
and style prompt toDigitalArt
, withsimple_negative
as the negative prompt.
In IF Display Text, observe how Llama 3 generated prompts differ from native prompts, with the top section displaying prompts
and the bottom showing negative prompts
.
Comparative Testing 2
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8222e13-20c1-49b0-bf39-9651d1c08ef3_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16a756ae-7c2d-458f-bbc4-1ec7d1fb9118_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F411e3af0-9d0f-4e2f-847a-500d62e8f077_1024x1024.png)
![Generate images using Llama 3’s prompts (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7e19975-05f9-4303-ab1e-f0ba2c5e9d90_1024x1024.png)
Generating images with same prompts without Llama 3 support.
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf9beec3-c9fb-4701-8fd3-12354acb1639_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbca15eca-fb37-4e2c-a41e-ac3c977dcc8c_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8330a3ae-6ded-4c70-8c18-42f9a79c46b2_1024x1024.png)
![Generate Images without Llama 3 support (Images Generate by Edmond Yip)](https://substackcdn.com/image/fetch/w_720,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8e4e3ba-ef0d-40aa-a2a2-1f1c010fffc0_1024x1024.png)
While both sets depict toy cats, Llama 3 enhanced prompts result have richer and more detailed in background context. However, some images lose the toy-like feel due to their realism, but it still showcasing the significant enhancement Llama 3 offers.
Conclusion
Extensions alongside Llama 3 greatly simplifies the process of enhancing prompts. Although occasional deviations may arise following enhancement, the overall test outcomes are highly satisfactory, particularly when the initial prompts lack detailed background descriptions.
The supplementary context provided by Llama 3 significantly enhances images, rendering it an indispensable element within Stable Diffusion’s prompt generation arsenal.