Commit graph

781 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
kingbri
b4cda78bcc Dependencies: Update Ruff
v0.6.5

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-19 22:39:08 -04:00
kingbri
c616b3b1ee Dependencies: Update PyTorch
v2.4.1 and update all associated wheels to use their 2.4 versions.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-19 22:32:23 -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
75af974c88 Model: Raise an error if the context length is too large
The dynamic generator gave a not-so-helpful exception already which
basically said to not exceed the max sequence length. Instead of
possible undefined behavior, error out.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-19 22:05:56 -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
ac4b3100d0 Actions: Fix pages build
The args openapi export does not work, so use environment vars for
the time being.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-18 21:02:56 -04:00
Brian Dashore
03189bcb6f
Merge pull request #189 from SecretiveShell/pydantic-config
Update the config system to use Pydantic internally, bridging the gap between the YAML and args. YAML is still the preferred method to configure TabbyAPI, but args are no longer separately maintained.
2024-09-18 20:41:41 -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
daa57ceada API: Upgrade config declarations
Some were using the old unwrap methods.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-17 00:42:39 -04:00
kingbri
7fe0dbd62f Tree: Update config_sample
Uses the new YAML generator.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 23:32:54 -04: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
8e6b8bd842 Update .gitignore
Ignore all "backup" files

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 22:48:13 -04:00
kingbri
26ad0ef744 API: Fix model info reporting
A deprecated preferences global var was being referenced.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 22:42:59 -04:00
kingbri
06a798d968 Main: Remove debug print statement for config object
Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-16 22:24:42 -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
f05229bce4 Merge branch 'main' into pydantic-config 2024-09-14 22:22:17 -04:00
kingbri
2a41910931 Model: Remove dev wheel setting checks
Removes TP and DRY sampler checks since those are in stable.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-14 22:14:43 -04:00
Brian Dashore
2d221832fb
Merge pull request #201 from theroyallab/lmfe_fix
Fix LMFE
2024-09-14 22:11:11 -04: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