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

config structure #745

Merged
merged 24 commits into from
Nov 30, 2024
Merged

config structure #745

merged 24 commits into from
Nov 30, 2024

Conversation

frederik-uni
Copy link
Contributor

@frederik-uni frederik-uni commented Nov 16, 2024

the args are too messed up. There are way too many options. that's why I converted it to a class structure. Instead of having tons of arguments it would make more sense to have a config file for everything. it's not loaded anywhere so its just the structure. the code would need to be changed a bit, but not much. it also adds typesafty

@frederik-uni frederik-uni marked this pull request as draft November 16, 2024 22:18
@frederik-uni
Copy link
Contributor Author

frederik-uni commented Nov 16, 2024

@zyddnys
Where should these args be placed in the config structure & should kernel_size be part of the config or params?

    """Set the convolution kernel size of the text erasure area to completely clean up text residues"""
    kernel_size: int = 3
    """By how much to extend the text mask to remove left-over text pixels of the original image."""
    mask_dilation_offset: int = 0

@frederik-uni
Copy link
Contributor Author

frederik-uni commented Nov 17, 2024

oh and which file extension should the config have? toml, yml, json? I used json for now

@frederik-uni frederik-uni marked this pull request as ready for review November 19, 2024 13:06
@frederik-uni
Copy link
Contributor Author

frederik-uni commented Nov 19, 2024

@zyddnys would be great if you could look over it. the goal was to make it easier to use. you could have different config files for different use cases, the arguments are grouped by category and the args now have specific arguments for specific modes. This makes it easier to distinguish between configs specific for translation & specific for modes. there are some exceptions like pre-dict, post-dict & kernel-size. the dicts are loaded before the translator is initialized & the kernel-size is set in the constructor so I left it alone.

The enums make it easier to write specific documentation for each translator/detector/inpainter/.... I haven't checked if there are other tools for documentation, but pydantic can be used to generate json-schema. im pretty sure there are other tools that can generate a more readable format for the readme from json-schema of python classes. I found this.

https://coveooss.github.io/json-schema-for-humans/#/ which could be useful

@zyddnys
Copy link
Owner

zyddnys commented Nov 23, 2024

conflict now

# Conflicts:
#	manga_translator/args.py
#	manga_translator/manga_translator.py
@frederik-uni
Copy link
Contributor Author

conflict now

@zyddnys resolved now

@zyddnys zyddnys merged commit 26fb926 into zyddnys:main Nov 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants