-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Pydantic config #189
Merged
Merged
Pydantic config #189
Conversation
This file contains 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
- add models for config options - add function to regenerate config.yml - replace references to config with pydantic compatible references - remove unnecessary unwrap() statements TODO: - auto generate env vars - auto generate argparse - test loading a model
- generate arg parser dynamically - remove legavy parser code
- convert pydantic to dict to avoid errors with current files - fix formatting
- load config from env vars (eg. TABBY_NETWORK_HOST) - remove print statements - improve command line args automation
SecretiveShell
force-pushed
the
pydantic-config
branch
from
September 11, 2024 15:15
6d28fdd
to
0d74591
Compare
Pydantic provides these helpers. Better to use these instead of the inspect lib. Signed-off-by: kingbri <bdashore3@proton.me>
Appending lines also requires a space between each one otherwise they'll squish together. Signed-off-by: kingbri <bdashore3@proton.me>
Remove access of private attributes and use safer functions. Also move generalized functions into utils files. Signed-off-by: kingbri <bdashore3@proton.me>
This is no longer needed because config is a singleton. Signed-off-by: kingbri <bdashore3@proton.me>
Config.yml and args take in two different values. Signed-off-by: kingbri <bdashore3@proton.me>
Signed-off-by: kingbri <bdashore3@proton.me>
These changes fix the amount and order of newlines to look pleasing for the user. However, the changes used in here are kind of hacky and need a proper fix that can contain the same level of efficiency. Signed-off-by: kingbri <bdashore3@proton.me>
Adheres to the old config.yml's descriptions and allows for newlines in generated YAML. Signed-off-by: kingbri <bdashore3@proton.me>
It makes sense for the LLM model groups to be clustered around each other with the least used groups towards the bottom. Signed-off-by: kingbri <bdashore3@proton.me>
This makes both config.yml and args more descriptive than before. Signed-off-by: kingbri <bdashore3@proton.me>
Signed-off-by: kingbri <bdashore3@proton.me>
Allows for generation from an existing config file. Primarily used for migration purposes. Signed-off-by: kingbri <bdashore3@proton.me>
These keys were changed as well to include a "log_" prefix like the CLI arguments. Signed-off-by: kingbri <bdashore3@proton.me>
If a sub-field exists in the model provided to the file generator, use it. Otherwise always fallback to the default factory. This prevents any subsequent errors from setting None. Signed-off-by: kingbri <bdashore3@proton.me>
Rollback to the old config if automigration fails. Signed-off-by: kingbri <bdashore3@proton.me>
- Let the user know that migration is going to be attempted - Have a more informative error message if auto-migration fails - Revert back to the old config file on failure - Don't load with a partially parsed config Signed-off-by: kingbri <bdashore3@proton.me>
Keep the models as a separate reference file without any extra functions. Signed-off-by: kingbri <bdashore3@proton.me>
Signed-off-by: kingbri <bdashore3@proton.me>
A deprecated preferences global var was being referenced. Signed-off-by: kingbri <bdashore3@proton.me>
Ignore all "backup" files Signed-off-by: kingbri <bdashore3@proton.me>
This is not a True default. Signed-off-by: kingbri <bdashore3@proton.me>
Remove the extraneous newlines from the beginning of the preamble. Signed-off-by: kingbri <bdashore3@proton.me>
Loading from file adds extra overhead for actions that don't rely on file loading. Signed-off-by: kingbri <bdashore3@proton.me>
This is not ideal because users may still have trouble understanding what a lora includes, but adding an example comment will help instead of leaving a blank line. Signed-off-by: kingbri <bdashore3@proton.me>
Uses the new YAML generator. Signed-off-by: kingbri <bdashore3@proton.me>
Some were using the old unwrap methods. Signed-off-by: kingbri <bdashore3@proton.me>
Properly add comments and newlines where they need to go. Signed-off-by: kingbri <bdashore3@proton.me>
The loader takes in the "draft" parameter, so map the config model to that when creating kwargs for initial load. Also map the old "draft" key to the new "draft_model" key. Signed-off-by: kingbri <bdashore3@proton.me>
Leaving blank will use the model's set value or auto-calculate. Signed-off-by: kingbri <bdashore3@proton.me>
Loaders that read use a safe type while loaders that write use both round-trip and safe options. Also don't create module-level parsers where they're not needed. Signed-off-by: kingbri <bdashore3@proton.me>
bdashore3
force-pushed
the
pydantic-config
branch
from
September 18, 2024 23:27
0379440
to
24ea85b
Compare
Signed-off-by: kingbri <bdashore3@proton.me>
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 PR rewrites the configuration logic to be a subclass of a pydantic model. This has the following benefits:
When a new config option is added to the pydantic models:
Possible benefits in the future:
Additional context
This has the side effect of solving #160