Visit ComfyUI Online for ready-to-use ComfyUI environment
Facilitates loading and managing text files from specified directory for AI tasks with flexible selection modes.
The LoadTextDirectory
node is designed to facilitate the loading and management of text files from a specified directory. This node is particularly useful for AI artists and developers who need to process or analyze large batches of text files efficiently. By allowing you to specify a directory and a pattern for file selection, the node can retrieve text content based on different modes such as single file, incremental file, or random selection. This flexibility makes it an essential tool for tasks that require dynamic text input, such as training AI models or generating text-based art. The node ensures that only valid text files with specified extensions are considered, providing a streamlined and error-free experience.
The mode
parameter determines how text files are selected from the directory. It offers three options: single_file
, incremental_file
, and random
. In single_file
mode, a specific file is selected based on the provided index. Incremental_file
mode allows for sequential file selection, starting from the given index and looping back to the beginning if the end is reached. The random
mode selects a file randomly, using the provided seed for reproducibility. This parameter is crucial for controlling the file selection process and adapting it to your specific needs.
The seed
parameter is an integer used to initialize the random number generator when the random
mode is selected. It ensures that the random selection of text files is reproducible, meaning the same seed will always result in the same file being selected. The default value is 0, and it can range from 0 to 18,446,744,073,709,551,615. This parameter is important for maintaining consistency in experiments or projects that require random file selection.
The index
parameter specifies the position of the text file to be loaded when using the single_file
or incremental_file
modes. It is an integer with a default value of 0, and it can range from 0 to 150,000. This parameter allows you to target specific files within the directory, providing precise control over which text content is loaded.
The label
parameter is a string that serves as an identifier for the batch of text files being processed. It has a default value of Text Batch 001
and is not multiline. This parameter is useful for organizing and labeling different sets of text files, especially when dealing with multiple batches or experiments.
The path
parameter is a string that specifies the directory path where the text files are located. It is not multiline and must be provided for the node to function. This parameter is essential as it directs the node to the correct location to load the text files.
The pattern
parameter is a string that defines the file pattern to match when searching for text files in the specified directory. The default value is *
, which matches all files. This parameter allows you to filter files based on specific naming conventions or extensions, ensuring that only relevant files are processed.
The text
output parameter provides the content of the text file that has been loaded. This string output is the primary data you will work with, whether for analysis, processing, or feeding into an AI model. It represents the actual text content extracted from the selected file.
The filename_text
output parameter returns the name of the text file that has been loaded. This string output is useful for tracking which file the text content originated from, aiding in organization and documentation of the files being processed.
path
parameter is correctly set to the directory containing your text files to avoid errors related to non-existent paths.pattern
parameter to filter files by specific extensions or naming conventions, which can help in managing large directories with mixed file types.random
mode, set a specific seed
value to ensure reproducibility in experiments or projects that require consistent random file selection.<path>
path
parameter is set to a valid directory path and that the directory exists on your system.<index>
index
parameter to ensure it is within the range of available files. Adjust the index or verify the directory contents.pattern
parameter is correctly set to match the desired text files and that the directory contains files with the allowed extensions.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.