Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sensitive case handler #2212

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

MindOfMatter
Copy link
Contributor

@MindOfMatter MindOfMatter commented Feb 8, 2024

Added a fix for get_config_item_or_set_default to better handle the case-sensitivity problem (don't get loras with a typo, style or model problem).

def correct_case_sensitivity(value, valid_values):
    """Corrects case sensitivity of a value or list of values based on a list of valid values.
       If a valid value is contained in the input value, it replaces it with the full valid value."""
     ...
     
by example
     
def sdxl_styles_corrector(value):
    return correct_case_sensitivity(value, modules.sdxl_styles.legal_style_names)

default_styles = get_config_item_or_set_default(
    key='default_styles',
    default_value=[
        "Fooocus V2",
        "Fooocus Enhance",
        "Fooocus Sharp"
    ],
    validator=sdxl_styles_validator,
    corrector=sdxl_styles_corrector
)

so if we have "My Hyper realistic preference Negative" it will fit with "My Hyper Realistic Preference Negative" in default_styles configuration

My changes :

  • replace all validator with better functions
  • add new corrector function (if validator first fail)
  • add new corrector function (if validator first fail)
  • add flags debug logs in function (optional)
  • improve get_config_item_or_set_default to handle each cases
  • add better validation for get_model_filenames
  • generic correct_case_sensitivity handle all possible issue cases
  • improve the loras_validator
  • add better sdxl_styles_validator / corrector (not have missing expected value anymore)
  • improve the error logs cases
  • change update_all_model_names call oder to better verification

Tested until 2 week ago from my dev branch of fork project :
MindOfMatter/Fooocus-MindOfMatter-Edition#4

README.md Outdated Show resolved Hide resolved
@mashb1t mashb1t added the Size M medium change, isolated, testing with care label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size M medium change, isolated, testing with care
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants