This commit introduces a series of refactoring and enhancements across multiple modules, improving code readability, consistency, and adding new functionalities.
Highlights:
1. `tests/test_hf_diffusers_nodes.py`:
- Removed unnecessary whitespace.
- Improved variable assignment consistency (e.g., `ret=ret[0]` to `ret = ret[0]`).
- Added a new test case `test_create_unet2d_model` for Unet2d model creation.
2. `server_endpoints.py`:
- Cleaned up commented-out code and added more descriptive comments.
- Refactored the construction of `real_git_path` for better readability and future maintenance.
- Implemented minor formatting improvements for better code structure.
3. `basic.py`:
- Introduced a new class `TupleNode` to handle tuple data types.
- Modified `StrBreakout` to include dynamic typing for list conversion.
- Enhanced code readability with better variable naming and added comments for clarity.
4. `pytorch_nodes.py`:
- Added import statements within functions for `torch`.
- New classes `SaveTorchTensor` and `LoadTorchTensor` added for saving and loading torch tensors.
- `GridSearchTraining` class updated with minor formatting changes.
5. `image.py`:
- In `FloodFillNode`, removed a redundant category assignment.
- Added two new classes: `DecorateHeightMap` and `RandomImageFromFolder`. These classes provide functionalities for decorating height maps with images and selecting random images from a folder, respectively.
6. `hf_diffusers_nodes.py`:
- Fixed formatting in tensor format options and added a new line for clarity.
- New class `CreateUnet2dModel` added for creating a UNet2D model with customizable parameters.
- Introduced `TrainUnet2dModel` for training a UNet2D model with a dataset, including detailed setup for the training process.
7. `config.yaml`:
- Added a new base path for `gitio` to centralize the configuration.
These changes aim to improve the maintainability of the codebase, streamline testing processes, and expand the functionalities within the modules, particularly related to image processing and model training in PyTorch and diffusers.
Imports Repo from the git module.
Removes unused imports such as InvalidGitRepositoryError, os, copy, re, and imports from custom modules.
Removes the check_for_js_extension() function and its related logic, which checked for and copied JavaScript extension files.
image.py:
Modifies the ImageStackAndMatch class:
Updates the input type specifications.
Adds a new function hex_to_rgb to convert hex color codes to RGB tuples.
Adds a new function pad_to_max_size to pad images to a specified size.
Adds a new function resize_image to resize images with interpolation.
Modifies the process_image function to use the new functions for scaling and padding.
Modifies the process_images function to process up to four images, scaling them, and stacking them into a tensor.
functional.py:
Adds a new class FuncAnysToLatent:
This class runs eval on given text with five "any" inputs and outputs a latent value.
Specifies input types for five "any" inputs and the text to evaluate.
Provides a func function that executes the provided code with the inputs and returns the result as a latent value.
basic.py:
Modifies the get_value function:
Adds a check to ensure that LIST is a list type before returning it; otherwise, it returns an error message.
This commit adds several new nodes to enable flexible typing and conversion between types:
- ValueToAny - Converts primitive values like ints, floats, strings, bools to Any type
- IterableToAny - Converts iterable values like lists, dicts to Any
- CallableToAny - Converts callables like functions to Any
- ObjectToAny - Converts tensor objects like images, latents etc to Any
The motivation is to allow passing different types flexibly into functions using Any typing. This enables writing functions in a more generic way by accepting Any instead of specific types.
The nodes convert the input values to Any and return debug info on what was converted. This allows tracing what types entered a function even if the function uses generic Any types.
No breaking changes, new nodes added:
- ValueToAny
- IterableToAny
- CallableToAny
- ObjectToAny
These provide building blocks for more flexible typing, opening up possibilities like:
- Writing utility and processing functions accepting Any instead of specific types
- Calling functions dynamically with values of different types
- Tracing and logging what types passed through a function
Next steps could include AnyToValue nodes, more specialized Any converters, and exploring uses for generic functions.
started creating whisper transcription node
modified how imports are handled to avoid importing the same moduels twice under different name spaces.
added basic.py to house simple functions that work on primitives.
NOTE: this update relies on change to /web/extensions that are not included in this commit, a future commit will include an install process for these changes.