generators were already cached across jobs but only implicitly — the first job per config silently paid the whole model load. adds: - POST /api/generators/preload: load a model into memory ahead of time (async, idempotent; state loading/ready/failed) - GET /api/generators: what's resident or in flight - POST /api/generators/unload: shutdown + free VRAM (409 while inference jobs run) cache key builder shared with the job path and pinned by a test so preload and job lookup can't drift apart.
25 lines
895 B
Python
25 lines
895 B
Python
# SPDX-License-Identifier: Apache-2.0
|
|
"""Pydantic request/response models for the API, plus tiny shared helpers
|
|
usable by both the real server and the dependency-light mock server."""
|
|
|
|
from fastvideo_studio.models.create_job_request import CreateJobRequest
|
|
from fastvideo_studio.models.generator_request import GeneratorRequest
|
|
from fastvideo_studio.models.settings_update import SettingsUpdate
|
|
from fastvideo_studio.models.create_dataset_request import CreateDatasetRequest
|
|
from fastvideo_studio.models.update_caption_request import UpdateCaptionRequest
|
|
|
|
|
|
def model_label(model_path: str) -> str:
|
|
"""Derive a readable label from an HF-style model path."""
|
|
return model_path.split("/")[-1].replace("-", " ").replace("_", " ")
|
|
|
|
|
|
__all__ = [
|
|
"CreateJobRequest",
|
|
"GeneratorRequest",
|
|
"SettingsUpdate",
|
|
"CreateDatasetRequest",
|
|
"UpdateCaptionRequest",
|
|
"model_label",
|
|
]
|