Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# Comprehensive Project Updates: LTX Video API and Client #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Model paths
CKPT_DIR=./app/model

# Default generation parameters
DEFAULT_NUM_INFERENCE_STEPS=40
DEFAULT_NUM_IMAGES_PER_PROMPT=1
DEFAULT_GUIDANCE_SCALE=3.0
DEFAULT_HEIGHT=480
DEFAULT_WIDTH=704
DEFAULT_NUM_FRAMES=121
DEFAULT_FRAME_RATE=25
DEFAULT_NEGATIVE_PROMPT="worst quality, inconsistent motion, blurry, jittery, distorted"

# Model precision configuration
USE_BFLOAT16=true

# Output configuration
OUTPUT_DIR=/app/outputs

# Version configuration for Docker tags
VERSION_PREFIX=v

# Logging level
LOG_LEVEL=INFO
63 changes: 63 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Docker Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ltx-video-api:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Generate version tags
id: tags
run: |
# Get current date in YYYYMMDD format
DATE_TAG=$(date +'%Y%m%d')
# Get short SHA
SHA_TAG=$(echo ${{ github.sha }} | cut -c1-7)
# Load version prefix from .env
VERSION_PREFIX=$(grep VERSION_PREFIX .env | cut -d '=' -f2)
# Create tag list
TAGS="${{ secrets.DOCKERHUB_USERNAME }}/ltx-video-api:latest,${{ secrets.DOCKERHUB_USERNAME }}/ltx-video-api:${VERSION_PREFIX}${DATE_TAG},${{ secrets.DOCKERHUB_USERNAME }}/ltx-video-api:${VERSION_PREFIX}${SHA_TAG}"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT

- name: Build and push LTX Video API Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/amd64

# Move cache to prevent cache growth
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
27 changes: 0 additions & 27 deletions .github/workflows/pylint.yml

This file was deleted.

44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Use NVIDIA CUDA base image
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
python3-pip \
python3-dev \
git \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements first to leverage Docker cache
COPY requirements.txt .

# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy application files
COPY . .

# Install LTX-Video package and inference dependencies
RUN pip3 install . && \
pip3 install accelerate matplotlib "imageio[ffmpeg]"

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV CKPT_DIR=/app/models
ENV OUTPUT_DIR=/app/outputs

# Create directories
RUN mkdir -p /app/models /app/outputs

# Expose port
EXPOSE 8000

# Run the FastAPI server
CMD ["python3", "api.py"]

# Add labels
LABEL maintainer="Lightricks"
LABEL description="LTX-Video API service"
LABEL version="1.0"
Loading