API: Integrate OpenAPI export script

Move OpenAPI export as an env var within the main function. This
allows for easy export by running main.

In addition, an env variable provides global and explicit state to
disable conditional wheel imports (ex. Exl2 and torch) which caused
errors at first.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-07-08 12:34:32 -04:00
parent 5e82b7eb69
commit 933268f7e2
4 changed files with 27 additions and 17 deletions

View file

@ -4,17 +4,20 @@ Manages the storage and utility of model containers.
Containers exist as a common interface for backends.
"""
import os
import pathlib
from loguru import logger
from typing import Optional
from backends.exllamav2.model import ExllamaV2Container
from common import config
from common.logger import get_loading_progress_bar
from common.utils import unwrap
# Global model container
container: Optional[ExllamaV2Container] = None
if not os.getenv("EXPORT_OPENAPI"):
from backends.exllamav2.model import ExllamaV2Container
# Global model container
container: Optional[ExllamaV2Container] = None
def load_progress(module, modules):