Merged
Conversation
- Implement comprehensive unit tests for SD1.5 model components including latent format, model configuration, checkpoint loading, CLIP encoding, and tokenizer functionality. - Introduce unit tests for SDXL model components covering latent format, model configuration, dual CLIP tokenizer/encoder, resolution handling, and differences from SD1.5. - Ensure tests validate expected behaviors and configurations for both models, including checks for required attributes, correct dimensionality, and integration with other components.
- Removed references to Flux and GGUF files in model loading and detection. - Updated `list_available_models` to exclude .gguf files. - Modified `detect_model_type` to raise ValueError for GGUF files. - Adjusted pipeline functions to eliminate Flux-specific logic. - Updated integration and unit tests to reflect the removal of GGUF/FLUX support. - Changed default model path in webui_settings.json for consistency.
- Implement tests to verify that HiresFix and Adetailer processors are called correctly based on user input. - Include tests for the Img2Img processor and ensure proper context creation with `PipelineContext.from_kwargs`. - Validate model type detection and capabilities for SD15 and SDXL models. - Add a test for context creation with hires settings. - Ensure all tests report their results clearly.
…on logic - Updated test cases in `test_feature_triggers.py` to replace `PipelineContext` with `Context`. - Renamed test functions for clarity and consistency. - Adjusted assertions in model detection tests to reflect changes in detection logic. - Updated error messages for clarity regarding unsupported GGUF files. - Ensured that Juggernaut XL models are correctly detected as SDXL based on new naming conventions.
…dability and performance - Simplified the calculation of start and end timesteps in `ksampler_util.py`. - Streamlined pre-run control logic and condition handling. - Enhanced the `apply_empty_x_to_equal_area` function for better clarity. - Updated `get_area_and_mult` to optimize batch handling and tensor operations. - Consolidated multi-scale preset definitions in `multiscale_presets.py` for brevity. - Improved logging and documentation across various functions in `sampling_util.py`. - Refined noise sampling methods to enhance efficiency and maintainability.
…ance - Simplified functions in SDToken.py, including parse_parentheses, token_weights, escape_important, and load_embed. - Removed unnecessary comments and docstrings for cleaner code. - Optimized embedding loading logic and error handling in load_embed. - Enhanced the SDTokenizer class by streamlining the initialization and tokenization processes. - Updated utility functions in utils.py for better clarity and efficiency, including parse_blocks, convert_time, and get_sigma. - Improved integration handling in the Integrations class and JHDIntegrations. - Consolidated and optimized the scale_samples function for better performance.
- Consolidated import statements for better readability. - Removed unnecessary docstrings and comments to streamline the code. - Simplified the logic in several methods, including `init_integrations`, `build`, and `get_window_args`. - Enhanced the handling of scale methods and warnings related to incompatible sizes. - Improved the structure of the `State` and `Config` classes for clarity. - Updated the `patch` method to handle YAML parameters more efficiently. - Refined the `window_partition` and `window_reverse` methods for better performance. - Adjusted the `get_shift` method to simplify the logic for avoiding duplicate shifts. - Cleaned up the `ApplyMSWMSAAttentionSimple` class for consistency with the main attention class.
…and maintainability
…t for improved model integration, fixed double CFG application in the sampling code
…ion for improved efficiency and consistency
- Added Flux2 model implementation in `src/NeuralNetwork/flux2/model.py`, featuring a dual-stream architecture for image generation. - Introduced `Flux2Params` dataclass for model configuration parameters. - Created `Flux2` class with methods for forward pass, patchifying, and unpatchifying images. - Developed `Flux2` latent format in `src/Utilities/Latent.py` with identity processing and VAE compatibility. - Implemented Klein text encoder in `src/clip/KleinEncoder.py`, including tokenization and attention mechanisms. - Updated sampling methods in `src/sample/sampling.py` to support Flux2 models. - Enhanced model sampling logic to accommodate new Flux2 architecture.
- Enhanced the convert_cond function to include pooled_output as 'y' in model_conds for models requiring it, such as Flux2.
…n mask handling and configuration options
…on for Flux2 models
…on mechanisms for improved performance
…Flux2 Klein model
…oss multiple modules
…r dtypes in QwenAttention
…d align tokenizer behavior with ComfyUI
…ing model reuse logic
… in Adetailer, HiresFix, Img2Img, and sampling functions
…oved model options and positional embedding support
…dimensions for Flux2 compatibility
…mensions and presets
…t handling for mock objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements comprehensive support for the Flux.2 Klein 4B Distilled model, porting and optimizing the architecture from ComfyUI to LightDiffusion-Next. It includes a custom transformer implementation, a specialized text encoder based on the Qwen architecture, and various pipeline optimizations to ensure high-quality, efficient generation.
Summary of Changes
Bug Fixes & Refinement
Verification