lllyasviel / Fooocus

Focus on prompting and generating
GNU General Public License v3.0
41.15k stars 5.79k forks source link

My local improvements for configurations (Suggestions) #1989

Closed MindOfMatter closed 9 months ago

MindOfMatter commented 9 months ago

Hello, I have modified the main code locally and suggest that you add these enhancement changes to your main branch,

Before you do anything, from your code or a new sub-request for example, I suggest only if you find these changes useful and correctly applied

  1. Add configuration for loras min max weight
    "default_loras_min_weight": -5,
    "default_loras_max_weight": 5,
chrome_GvDTNLEhfk
  1. Add max loras property (more than 5 + dynamically according to default_loras)

"default_loras_max_number": 20,

chrome_Gyh13u8Di7
  1. 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

  1. added a powershell script to generate all missing cmd input presets and ask to run one of available presets (by number)

update_runs.zip

powershell_ise_s1BQd0XYCK
  1. add standard resolutions
    default_value = [
        '704*1408', '704*1344', '768*1344', '768*1280', '832*1216', '832*1152',
        '896*1152', '896*1088', '960*1088', '960*1024', '1024*1024', '1024*960',
        '1088*960', '1088*896', '1152*896', '1152*832', '1216*832', '1280*768',
        '1344*768', '1344*704', '1408*704', '1472*704', '1536*640', '1600*640',
        '1664*576', '1728*576', '1920*1080', '800*600', '600*800',
        '1200*900', '900*1200', '1600*1200', '1200*1600', 
        '1191*842', '842*1191', '1280*720', '2560*1440'
    ],
chrome_YYC1SqLYNZ
  1. added my new styles
chrome_Je3LtN1eQN
  1. add enable button for lora (by default true / not affect json load / if False equivalent to None) to allows to disable temporary the lora without searching again
chrome_57uKLSm7Nw
  1. more (search for any new changes I've made locally to improve the fooocus application)

If you're interested in my local changes, I'll send you my modifications for each change.

eddyizm commented 9 months ago

You can fork and make a PR for your changes, add your notes in detail and see if it gets approved. Someone else may want to try out your changes but may not know how to integrate or is weary of messing with the original code base.

MindOfMatter commented 9 months ago

You can fork and make a PR for your changes, add your notes in detail and see if it gets approved. Someone else may want to try out your changes but may not know how to integrate or is weary of messing with the original code base.

I just split my changes in different local branches from this repo git project

origin/main -- MindOfMatter_Suggestions_modifications/main (updated with main) -- -- MindOfMatter_Suggestions_modifications/add_min_max_loras_weight -- -- MindOfMatter_Suggestions_modifications/add_max_loras_config -- -- MindOfMatter_Suggestions_modifications/add_presets -- -- MindOfMatter_Suggestions_modifications/add_styles -- -- MindOfMatter_Suggestions_modifications/not_sensitive_case_config_fixer -- -- MindOfMatter_Suggestions_modifications/add_standard_resolutions -- -- MindOfMatter_Suggestions_modifications/update_runs -- -- MindOfMatter_Suggestions_modifications/add_loras_enable_buton -- MindOfMatter_Suggestions_modifications/test (used locally with all merged features to test it locally)

Can I push these branches and create PRs for each?

Or it is better to create forked project with references?

In both cases, I will share documentation of each changes

(for now I locked to prevent any push "git remote set-url origin dummy_url")

Thanks take time to reply :)

eddyizm commented 9 months ago

Hi, you need to create a fork in order to create PR. Separate might be have a better chance to get merged, however I could be wrong. That is up to you.

mashb1t commented 9 months ago

@MindOfMatter thank you for your cointribution, much appreciated. Most of your improvements have already been discussed in issues / PRs and were declined due to cvarious reasons. Please find more information below:

  1. https://github.com/lllyasviel/Fooocus/issues/1047
  2. https://github.com/lllyasviel/Fooocus/issues/1205 (6th LoRA => hardcoded LCM)
  3. nice addition!
  4. https://github.com/lllyasviel/Fooocus/pull/1484
  5. https://github.com/lllyasviel/Fooocus/pull/1617
  6. this is an individual change, feel free to also add it in a PR but Fooocus normally merges all styles of an author, which would require meaningful novelties in prompt styles
  7. nice addition!
  8. plus in general: please check out the links in the previous points and feel free to provide a split MR for each feature so it's easier reviewable

You're not permitted to create branches directly on the Fooocus repository as remote, but please create a fork, push your branches there and create PRs for the ones still relevant after reviewing the provided links.

Thanks!

mashb1t commented 9 months ago

Closing this issue, continuing discussions in to-be-created PRs