API: Split functions into their own files

Previously, generation function were bundled with the request function
causing the overall code structure and API to look ugly and unreadable.

Split these up and cleanup a lot of the methods that were previously
overlooked in the API itself.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-03-12 01:31:59 -04:00 committed by Brian Dashore
parent 104a6121cb
commit 6f03be9523
5 changed files with 376 additions and 294 deletions

View file

@ -74,3 +74,16 @@ async def load_model_gen(model_path: pathlib.Path, **kwargs):
async def load_model(model_path: pathlib.Path, **kwargs):
async for _, _, _ in load_model_gen(model_path, **kwargs):
pass
def load_loras(lora_dir, **kwargs):
"""Wrapper to load loras."""
if len(container.active_loras) > 0:
unload_loras()
return container.load_loras(lora_dir, **kwargs)
def unload_loras():
"""Wrapper to unload loras"""
container.unload(loras_only=True)