Commit graph

312 commits

Author SHA1 Message Date
kingbri
d5e4285346 Signals: Split signal handler between sync and async
Asyncio requires a closure of the event loop while sync can use SystemExit
to kill the program.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-19 23:31:29 -04:00
TerminalMan
3aeddc5255
fix issues with optional dependencies (#204)
* fix issues with optional dependencies

* format document

* Tree: Format and comment
2024-09-19 22:24:55 -04:00
kingbri
b30336c75b Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-18 21:42:01 -04:00
kingbri
edf3a00310 Config: Make API server literals case insensitive
There's no native way to handle case insensitivity in pydantic, so
add a validator which converts the API server input to be lowercase.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-18 21:39:18 -04:00
kingbri
2fd02cf4fc Startup actions: Add openapi var check
This is required to exit once the openapi spec is created.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-18 21:08:45 -04:00
kingbri
4cf85514f7 Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-18 20:36:17 -04:00
kingbri
24ea85b3c5 Tree: Use safe loader for YAML
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>
2024-09-18 19:26:51 -04:00
TerminalMan
6c7542de9f migrate all yaml loaders to ruamel.yaml 2024-09-18 11:33:15 +01:00
kingbri
63634beb5e Config: Clarify Rope alpha options
Leaving blank will use the model's set value or auto-calculate.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-17 23:03:28 -04:00
kingbri
754fb15f23 Config: Fix draft model migration and loading
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>
2024-09-17 22:48:56 -04:00
kingbri
a34bd9a684 Config: Alter YAML generation script for formatting adherence
Properly add comments and newlines where they need to go.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-17 22:44:42 -04:00
TerminalMan
948fcb7f5b migrate to ruamel.yaml 2024-09-18 01:06:34 +01:00
TerminalMan
bb4dd7200e fix defaults for api_servers 2024-09-17 15:41:32 +01:00
kingbri
63f8c46a92 Config: Make a better description for lora config
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>
2024-09-16 23:29:39 -04:00
kingbri
852ea8faaa Config: Don't load from file if actions present
Loading from file adds extra overhead for actions that don't rely
on file loading.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 23:29:07 -04:00
kingbri
ececce172e Config: Fix addition of preamble
Remove the extraneous newlines from the beginning of the preamble.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 23:06:01 -04:00
kingbri
f6fb60a6ed Config: Inline model loading is False
This is not a True default.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 22:54:35 -04:00
kingbri
46f9fff210 Config: Move config file generation to tabby_config
Keep the models as a separate reference file without any extra
functions.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 22:22:24 -04:00
kingbri
d2d07ed92d Config: Update auto-migration flow
- 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>
2024-09-16 18:15:50 -04:00
kingbri
ebe7f3567e Config: Alter migration error handling and cleanup
Rollback to the old config if automigration fails.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 18:02:18 -04:00
kingbri
e60c4ba5bc Config: Fix existing value check
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>
2024-09-16 17:51:40 -04:00
kingbri
c715094cdc Config: Add logging config to migration checks
These keys were changed as well to include a "log_" prefix like the
CLI arguments.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 12:35:33 -04:00
kingbri
81ae461eb8 Config: Allow existing values to get included in generated file
Allows for generation from an existing config file. Primarily used
for migration purposes.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 12:19:58 -04:00
TerminalMan
7f03003437 rephrase info message 2024-09-16 14:18:54 +01:00
TerminalMan
564bdcf0a8 add legacy config converter 2024-09-16 14:12:47 +01:00
kingbri
b6dd21f737 Config: Handle default factories in config generation
Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 00:55:46 -04:00
kingbri
3340c3bf2f Config: Rewrite descriptions
This makes both config.yml and args more descriptive than before.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 00:55:14 -04:00
kingbri
4c8bb42ec1 Config: Reorder models
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>
2024-09-16 00:55:14 -04:00
kingbri
8ff9f2c6c0 Config: Rewrite docstrings for models
Adheres to the old config.yml's descriptions and allows for newlines
in generated YAML.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 00:55:14 -04:00
kingbri
250d76f5c6 Config: Alter YAML generator function
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>
2024-09-16 00:55:11 -04:00
TerminalMan
92af656705 improve config generation action 2024-09-15 17:50:37 +01:00
kingbri
5bfa952671 Actions: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-14 22:05:11 -04:00
kingbri
d013729b7d Config: Add aliases for logging config
Config.yml and args take in two different values.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-14 21:56:16 -04:00
kingbri
6f28cfe905 Logging: Remove preferences global
This is no longer needed because config is a singleton.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-14 21:49:44 -04:00
kingbri
a09dd802c2 Config: Cleanup and organize functions
Remove access of private attributes and use safer functions. Also
move generalized functions into utils files.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-14 21:48:39 -04:00
TerminalMan
0903f852db add export openAPI to config 2024-09-15 00:17:36 +01:00
TerminalMan
533e7c9119 remove unnecessary code 2024-09-14 22:49:37 +01:00
TerminalMan
dc4946b565 make pydantic do all the validation 2024-09-13 10:21:27 +01:00
kingbri
d5b3fde319 Config: Fix descriptions
Appending lines also requires a space between each one otherwise
they'll squish together.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-12 22:43:30 -04:00
kingbri
21747bf9e4 Args: Switch to use model_field for everything
Pydantic provides these helpers. Better to use these instead of
the inspect lib.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-12 22:18:20 -04:00
TerminalMan
6e935c565e remove private attributes in args 2024-09-13 00:37:17 +01:00
TerminalMan
eb5f42c845 add error message for invalid use_as_default 2024-09-12 23:48:24 +01:00
TerminalMan
8b48f00271 fix model names 2024-09-12 17:00:07 +01:00
TerminalMan
05f1c3e293 fix line lengths 2024-09-11 21:43:30 +01:00
TerminalMan
c6f9806ec6 remove unused imports 2024-09-11 18:00:29 +01:00
TerminalMan
0d7459191c fix arg parser for dict types 2024-09-11 16:13:31 +01:00
TerminalMan
e8fcecd56a Merge remote-tracking branch 'upstream/main' into HEAD 2024-09-11 15:57:18 +01:00
kingbri
b9e5693c1b API + Model: Apply config.yml defaults for all load paths
There are two ways to load a model:
1. Via the load endpoint
2. Inline with a completion

The defaults were not applying on the inline load, so rewrite to fix
that. However, while doing this, set up a defaults dictionary rather
than comparing it at runtime and remove the pydantic default lambda
on all the model load fields.

This makes the code cleaner and establishes a clear config tree for
loading models.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-10 23:35:35 -04:00
kingbri
7baef05b49 Transformers Utils: Fix file read
Use asynchronous JSON reading

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-10 22:41:39 -04:00
kingbri
62beb2b1c8 Config: Fetch the correct dict for draft_model and lora
Fixed fetching from the merged config instead of the sub-config

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-10 21:30:53 -04:00