Giter VIP home page Giter VIP logo

sdxl_prompt_styler's Introduction

SDXL Prompt Styler, a custom node for ComfyUI

SDXL Prompt Styler

SDXL Prompt Styler Screenshot

SDXL Prompt Styler Advanced

SDXL Prompt Styler Advanced Screenshot

SDXL Prompt Styler is a node that enables you to style prompts based on predefined templates stored in multiple JSON files. The node specifically replaces a {prompt} placeholder in the 'prompt' field of each template with provided positive text.

The node also effectively manages negative prompts. If negative text is provided, the node combines this with the 'negative_prompt' field from the template. If no negative text is supplied, the system defaults to using the 'negative_prompt' from the JSON template. This flexibility enables the creation of a diverse and specific range of negative prompts.

Changelog

This section details the updates and new features committed over time, organized chronologically with the most recent changes at the top.

Commit date (2024-01-26)

New Features

  • SDXL Prompt Styler Advanced: New option to copy the positive G prompt tokens to L, removing duplicates

Commit date (2024-01-19)

New Features

  • SDXL Prompt Styler: Add toggles to disable styling for positive, negative, or both sentiments (bypass mode)

Commit date (2023-08-27)

New Features

  • SDXL Prompt Styler Advanced: New node for more elaborate workflows with linguistic and supportive terms. Selector to change the split behavior of the negative prompt. Special thanks to @WinstonWoof and @Danamir for their contributions!
  • SDXL Prompt Styler: Minor changes to output names and printed log prompt.

Commit date (2023-08-11)

Important Update

With the latest changes, the file structure and naming convention for style JSONs have been modified. If you've added or made changes to the sdxl_styles.json file in the past, follow these steps to ensure your styles remain intact:

  1. Backup: Before pulling the latest changes, back up your sdxl_styles.json to a safe location.
  2. Migration: After updating the repository, create a new JSON file in the styles directory. Move your custom styles from the backup of sdxl_styles.json into this new file.
  3. Unique Style Names: While the system now detects duplicates and appends a suffix to ensure uniqueness, it's a best practice to ensure your style names are originally unique to prevent any potential confusion.
  4. Managing Included JSON Files: If you prefer not to load specific included JSON files, consider renaming or moving them to a different location outside of the styles directory. The system will load all JSON files present in the specified directory.

New Features

  • Loading from Multiple JSON Files: The system can now load styles from multiple JSON files present in the specified directory, ensuring the uniqueness of style names by appending a suffix to duplicates.
  • Enhanced Error Handling: Improved error handling for file reading, data validity, and template replacement functions.

Usage Example with SDXL Prompt Styler

Template example from a JSON file:

[
    {
        "name": "base",
        "prompt": "{prompt}",
        "negative_prompt": ""
    },
    {
        "name": "sai-enhance",
        "prompt": "breathtaking {prompt} . award-winning, professional, highly detailed",
        "negative_prompt": "ugly, deformed, noisy, blurry, distorted, grainy"
    }
]
style = "sai-enhance"
text_positive = "a futuristic pop up tent in a forest"
text_negative = "dark"

The above will generate the following styled prompts:

text_positive_styled = "breathtaking a futuristic pop up tent in a forest . award-winning, professional, highly detailed"
text_negative_styled = "ugly, deformed, noisy, blurry, distorted, grainy, dark"

Installation

To install and use the SDXL Prompt Styler nodes, follow these steps:

  1. Open a terminal or command line interface.
  2. Navigate to the ComfyUI/custom_nodes/ directory.
  3. Run the following command: git clone https://github.com/twri/sdxl_prompt_styler.git
  4. Restart ComfyUI.

This command clones the SDXL Prompt Styler repository into your ComfyUI/custom_nodes/ directory. You should now be able to access and use the nodes from this repository.

Inputs

  • text_positive - text for the positive base prompt
  • text_negative - text for the negative base prompt
  • log_prompt - print inputs and outputs to stdout

Outputs

  • text_positive - combined prompt with style for positive prompt
  • text_negative - combined prompt with style for negative prompt

sdxl_prompt_styler's People

Contributors

danamir avatar twri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sdxl_prompt_styler's Issues

Feature request: add a dropdown to select the json file to use

Thanks for your very nice Styles custom node, I have it in use with all my workflows.

Since the update, all json files load. This can be convenient, but it also can lead to a very long dropdown to select a style ... too long atually to have good oversight

I know I can change and shuffle the json files, and there also is the search field, but I had this idea if maybe it would be possible to add a dropdown selector, where one can choose which styles show up (which json file will be used) in the second selector? And there can also be an entry that says 'all'. It would be a bit more convenient than the search field.

Greetings, Rudy.

Additional Variants

more of a question than an issue.

Do you mind if people release variants of this node with different .json files.

I have a version with Fooocus styles included and would like to post it on git but only if you don't mind - I would link back to your original if you agree.

thanks

Mokkaboss1

Feature request: custom style prompt

The included styles in this node are pretty good, but there're actually endless styles, it's impossible to include all, and if you include more the list will become too long to use easily. I propose to add a custom style prompt input, so that user can use an artist style, such as "breathtaking {prompt} by Anna Dittmann," weights can also be easily added by user. This should work as long as the simple format is followed, i.e., the style contains a {prompt} placeholder, which is simple to validate. When there're values in both the selected style and custom style, the custom one should take precedence. Please consider adding this feature., which will make this node the most powerful prompt styler.

Question (not an issue).

Hello there...

Love your custom nodes for ComfyUI but have a request...
Could you possibly add a way to randomize the style on every gen ?
And perhaps an option to go thru them sequentially...

THanks for your time !
And hope to hear from you.

Peter Lunk

reddit.com/user/MrLunk

不晓得你能否看懂中文。。。

风格里有一处少了个“.”,就是
{
"name": "sai-texture",
"prompt": "texture {prompt} top down close-up",
"negative_prompt": "ugly, deformed, noisy, blurry"
}这一句,
应该为
{
"name": "sai-texture",
"prompt": "texture {prompt} . top down close-up",
"negative_prompt": "ugly, deformed, noisy, blurry"
}
我用它在sd webui里生成xy图时这一项报错所以发现了
另外在您的插件能否在comfyui里用xy表格来使用,我没有找到方法

Prompt outputs failed validation

I'm getting the following error on any style I select. What do I need to do to fix this?

Prompt outputs failed validation
SDXLPromptStyler:

  • Value not in list: style: 'AR Art Variant_Uncategorized' not in (list of length 106)

Thank you

Feature Request

It would be great if the following two additions could be made:

  1. Stack the styles. It would be great to offer the ability to select up to three styles instead of having to chain them together.
  2. Output text of selected style as a String. In addition to the positive and negative prompts, it would be great to output the name of the selected style. This could be used to name files/directories when saving images.

Thanks for the custom node as I use it all the time!!!

Prompt engineering help needed

Dear twri,

This project is AMAZING, and I have never thought simple yet sophisticated prompts can have such effective and dramatic on any images.

We are building a super cool image generation product for the masses, and I would love to hear your advice on prompt engineering. Please reach out to me at [email protected]. I am dying to speak with you.

Sincerely,
teteted

JSON file won't load

Awesome node, thanks for building this. It is exactly what I was looking for.

I have one JSON file that will not load. It is the sdxl_styles_fooocus.json file that is attached. I have put other JSON files in the same directory that have successfully loaded into the node. For some reason I cannot determine, this file will not load.

Is there a name length limit or something else I am missing?

Thank you!

Feature: Randomize Style

Any chance this can be added? I was about to take all the styles and create my own wildcard but maybe this isn't something too hard to implement so I can keep on using the nodes.

required_input_missing style_positive

Hey there,

I got this issue; all the settings were filled, and the inference worked fine in Comfyui. This issue is thrown by API.

{ "error": { "error": { "type": "prompt_outputs_failed_validation", "details": "", "message": "Prompt outputs failed validation", "extra_info": {} }, "node_errors": { "259": { "errors": [ { "type": "required_input_missing", "details": "style_positive", "message": "Required input is missing", "extra_info": { "input_name": "style_positive" } }, { "type": "required_input_missing", "details": "style_negative", "message": "Required input is missing", "extra_info": { "input_name": "style_negative" } } ], "class_type": "SDXLPromptStyler", "dependent_outputs": [ "17", "346", "187", "103" ] } } } }

Not an issue, a request but not found an other place to ask ;)

Hi,

First your node is really great. I would like to know if it's possible to make like in Fooocus v2, a multi select style that will be merged as in Fooocus v2 ? It's great and work very well to get a specific style and result and could be great in your node.

Hope it'll be possible one day :)
Thx

Matt

how to implement sdxl_prompt_styler.py

Greetings,
Thanks for sharing the prompt styler, how do you implement the script: sdxl_prompt_styler.py(Any examples would be nice inclusion). Looking forward to hearing with you.
Best,
Andy

Can't connect node to positive and negative prompt

Why can't this node behave and be compatible and act like a conditinong node directly? I'd love to use this for 1.5 workflow too but I can't seem to connect this node to a Ksampler positive and negative input respectively. This would be super useful. What am I missing here?

Feature copy G prompt to L

Hello,

I did add a feature on my fork of sdxl_prompt_styler adding a new option to the advanced node. It is used to copy the content of G text to L, deduplicating existing tokens found on both prompts.

This is used mostly by convenience because some models behave better with the same text in G and L. It kinda acts as a "overpowered text control" option.

Do you want a PR of this feature ?

Many duplicate keywords after txt2img usage by SDXL Styler

hi,
first of all, thank you for your work. I like to use the tool, but it also took me quite a bit of work after I started using it.
Since I do a lot of testing, I often used the "send to txt2img" function in PGN Info as well, only to find that my prompt looked like this

<parameters
ethereal fantasy concept art of ethereal fantasy concept art of professional 3d model professional 3d model professional 3d model 1girl, best quality, masterpiece, ultra highe res,raw photo,supercute,detailed...>

By the way, the same thing happens in the Negative prompt, so now, every time I use SDXL Styler, I have to clean up my prompt afterwards before I can use it.
It would be nice if you include a function in the script that.
First, checks if the keyword is already included and second, also removes the redundant (deselected style keyword) from the prompt when it reappears in the prompt, and third, doesn't insert it multiple times in a row each time you sent the prompt with txt2img to the prompt.

many thanks and best regards
LordKa

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.