ComfyUI  >  Nodes  >  Comfyui_MiniCPMv2_6-prompt-generator >  🐾Prompt_Generator

ComfyUI Node: 🐾Prompt_Generator

Class Name

Prompt_Generator

Category
Comfyui_MiniCPMv2_6-prompt-generator
Author
pzc163 (Account age: 890 days)
Extension
Comfyui_MiniCPMv2_6-prompt-generator
Latest Updated
8/30/2024
Github Stars
0.1K

How to Install Comfyui_MiniCPMv2_6-prompt-generator

Install this extension via the ComfyUI Manager by searching for  Comfyui_MiniCPMv2_6-prompt-generator
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Comfyui_MiniCPMv2_6-prompt-generator in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🐾Prompt_Generator Description

AI prompt generation node for detailed image prompts using advanced language models, enhancing image generation creativity and quality.

🐾Prompt_Generator:

The Prompt_Generator node is designed to assist AI artists in generating detailed and contextually rich prompts for image generation tasks. This node leverages advanced language models to create prompts that can be used with image generation tools like Stable Diffusion. By providing a variety of caption methods, it allows you to generate short, long, or detailed descriptions of images, enhancing the creative process and ensuring high-quality outputs. The main goal of this node is to streamline the prompt creation process, making it easier for you to produce vivid and accurate descriptions that can significantly improve the results of your image generation projects.

🐾Prompt_Generator Input Parameters:

folder_path

This parameter specifies the path to the folder containing the images you want to generate prompts for. It is a required field and should be a string representing the directory path. The default value is "Path to your image folder".

caption_method

This parameter determines the style of the prompt to be generated. It offers three options: caption, short_prompt, and long_prompt. The caption option generates a detailed description with relevant tags, short_prompt creates a concise prompt for image generation, and long_prompt produces a rich, detailed prompt in the style of Midjourney. The default value is long_prompt.

max_new_tokens

This parameter sets the maximum number of new tokens to be generated in the prompt. It is an integer value with a default of 2048, a minimum of 1, and a maximum of 4096. Adjusting this value can control the length and detail of the generated prompt.

num_beams

This parameter controls the number of beams used in the beam search algorithm during prompt generation. It is an integer value with a default of 3, a minimum of 1, and a maximum of 64. Higher values can improve the quality of the generated prompt but may increase computation time.

images

This optional parameter allows you to directly input images for which prompts need to be generated. It accepts image files and can be used if you prefer not to specify a folder path.

filenames

This optional parameter is a string that forces input of filenames for the images. It is useful when you have specific image files you want to generate prompts for.

captions

This optional parameter is a string that forces input of existing captions for the images. It can be used to refine or build upon existing descriptions.

prefix_caption

This optional parameter allows you to add a prefix to the generated captions. It is a multiline string with a default value of an empty string.

suffix_caption

This optional parameter allows you to add a suffix to the generated captions. It is a multiline string with a default value of an empty string.

replace_tags

This optional parameter allows you to specify tags that should be replaced in the generated captions. It is a multiline string with a default value of "replace_tags eg:search1:replace1;search2:replace2".

🐾Prompt_Generator Output Parameters:

IMAGE

This output parameter returns the images for which prompts were generated. It helps in verifying the generated prompts against the original images.

STRING (filenames)

This output parameter returns the filenames of the images. It helps in identifying which prompts correspond to which images.

STRING (captions)

This output parameter returns the generated captions or prompts. These are the detailed descriptions or prompts created based on the input images and specified parameters.

STRING (folder_path)

This output parameter returns the folder path where the images are stored. It helps in keeping track of the source directory for the images.

INT (batch_size)

This output parameter returns the batch size used during the prompt generation process. It helps in understanding the scale of the operation performed.

🐾Prompt_Generator Usage Tips:

  • To generate highly detailed prompts, use the long_prompt option in the caption_method parameter.
  • Adjust the max_new_tokens parameter to control the length of the generated prompts. Higher values will produce more detailed descriptions.
  • Use the prefix_caption and suffix_caption parameters to add custom text before or after the generated prompts, enhancing their context and relevance.
  • Experiment with the num_beams parameter to find the optimal balance between prompt quality and computation time.

🐾Prompt_Generator Common Errors and Solutions:

"FileNotFoundError: [Errno 2] No such file or directory"

  • Explanation: This error occurs when the specified folder_path does not exist or is incorrect.
  • Solution: Ensure that the folder_path parameter is set to a valid directory path containing the images.

"ValueError: max_new_tokens must be between 1 and 4096"

  • Explanation: This error occurs when the max_new_tokens parameter is set outside the allowed range.
  • Solution: Adjust the max_new_tokens parameter to a value between 1 and 4096.

"ValueError: num_beams must be between 1 and 64"

  • Explanation: This error occurs when the num_beams parameter is set outside the allowed range.
  • Solution: Adjust the num_beams parameter to a value between 1 and 64.

"TypeError: images must be of type IMAGE"

  • Explanation: This error occurs when the images parameter is not provided in the correct format.
  • Solution: Ensure that the images parameter is set to valid image files.

"KeyError: 'caption_method'"

  • Explanation: This error occurs when an invalid option is provided for the caption_method parameter.
  • Solution: Ensure that the caption_method parameter is set to one of the following options: caption, short_prompt, or long_prompt.

🐾Prompt_Generator Related Nodes

Go back to the extension to check out more related nodes.
Comfyui_MiniCPMv2_6-prompt-generator
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.