Add video generation API with job tracking and model loading
This commit is contained in:
+3
-10
@@ -15,7 +15,7 @@ from ltx_pipelines.utils.args import ImageConditioningInput
|
||||
from PIL import Image
|
||||
|
||||
from app.config import settings
|
||||
from app.database import JobDB, JobRecord, VALID_FRAME_COUNTS
|
||||
from app.database import JobDB, JobRecord
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -36,6 +36,7 @@ class LtxService:
|
||||
lora_config = self._parse_lora_paths(settings.ltx_loras)
|
||||
quantization = self._build_quantization_policy()
|
||||
|
||||
q = settings.ltx_gemma_quantization or None
|
||||
self.pipeline = await asyncio.to_thread(
|
||||
DistilledPipeline,
|
||||
distilled_checkpoint_path=settings.ltx_distilled_checkpoint,
|
||||
@@ -44,6 +45,7 @@ class LtxService:
|
||||
loras=lora_config,
|
||||
device=settings.ltx_device,
|
||||
quantization=quantization,
|
||||
gemma_quantization=q,
|
||||
)
|
||||
logger.info("Pipeline loaded successfully")
|
||||
|
||||
@@ -100,15 +102,6 @@ class LtxService:
|
||||
fps = request_params.get("fps", settings.default_fps)
|
||||
seed = request_params.get("seed")
|
||||
|
||||
if num_frames not in VALID_FRAME_COUNTS:
|
||||
candidates = sorted(
|
||||
f for f in VALID_FRAME_COUNTS if abs(f - num_frames) <= 8
|
||||
)
|
||||
raise ValueError(
|
||||
f"num_frames must be 8n+1. Got {num_frames}. "
|
||||
f"Closest valid: {candidates[:4]}"
|
||||
)
|
||||
|
||||
job = JobRecord(
|
||||
id=job_id,
|
||||
status="pending",
|
||||
|
||||
Reference in New Issue
Block a user