Add .env.example, Makefile; fix fp8_scaled_mm quantization policy
- Use build_policy(checkpoint_path) for fp8_scaled_mm - Add .env.example template - Add Makefile with common targets (install, api, docs, clean, lint)
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
PYTHON := .venv/bin/python
|
||||||
|
PIp := .venv/bin/pip
|
||||||
|
UVICORN := .venv/bin/uvicorn
|
||||||
|
LTX_PKG := libs/LTX-2
|
||||||
|
DB := app/jobs.db
|
||||||
|
PORT ?= 8000
|
||||||
|
RELOAD ?= --reload
|
||||||
|
|
||||||
|
.PHONY: install lint api clean docs
|
||||||
|
|
||||||
|
# Install project deps (LTX packages must be installed first manually)
|
||||||
|
install:
|
||||||
|
$(PIP) install -r requirements.txt
|
||||||
|
|
||||||
|
# Run the API server
|
||||||
|
api:
|
||||||
|
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
|
||||||
|
$(UVICORN) app.main:app --host 0.0.0.0 --port $(PORT) $(RELOAD)
|
||||||
|
|
||||||
|
# Generate OpenAPI docs as JSON
|
||||||
|
docs:
|
||||||
|
$(PYTHON) -c "import json; from app.main import app; json.dump(app.openapi(), open('openapi.json', 'w'), indent=2)"
|
||||||
|
|
||||||
|
# Clean up generated artifacts
|
||||||
|
clean:
|
||||||
|
rm -rf videos/*.mp4 $(DB) *.db __pycache__ app/__pycache__
|
||||||
|
|
||||||
|
# Lint
|
||||||
|
lint:
|
||||||
|
@command -v ruff >/dev/null && .venv/bin/ruff check app/ || echo "ruff not installed"
|
||||||
|
@command -v flake8 >/dev/null && .venv/bin/flake8 app/ || echo "flake8 not installed"
|
||||||
|
$(PYTHON) -m py_compile app/main.py app/config.py app/models.py app/service.py app/database.py
|
||||||
|
@echo "Syntax OK"
|
||||||
+2
-8
@@ -83,15 +83,9 @@ class LtxService:
|
|||||||
fuse_rule=fp8_cast_fuse_rule,
|
fuse_rule=fp8_cast_fuse_rule,
|
||||||
)
|
)
|
||||||
if q == "fp8_scaled_mm":
|
if q == "fp8_scaled_mm":
|
||||||
from ltx_core.quantization.fp8_scaled_mm import (
|
from ltx_core.quantization.fp8_scaled_mm import build_policy as fp8_build
|
||||||
FP8_SCALED_MM_MODULE_OPS,
|
|
||||||
fp8_scaled_mm_fuse_rule,
|
|
||||||
)
|
|
||||||
from ltx_core.quantization.policy import QuantizationPolicy
|
|
||||||
|
|
||||||
return QuantizationPolicy(
|
return fp8_build(settings.ltx_distilled_checkpoint)
|
||||||
module_ops=FP8_SCALED_MM_MODULE_OPS, fuse_rule=fp8_scaled_mm_fuse_rule
|
|
||||||
)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def submit_job(
|
async def submit_job(
|
||||||
|
|||||||
Reference in New Issue
Block a user