Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ jobs:

- name: ort identity (cpu)
run: cargo test -p kernelport-backend-ort --test identity

python-scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install PyYAML
run: pip install pyyaml

- name: manifest_to_serve_args tests
run: python tests/test_manifest_serve_args.py
127 changes: 127 additions & 0 deletions .github/workflows/deploy-lambda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Deploy KernelPort (LuxTTS) to Lambda Cloud: build/push images to GHCR, launch GPU instance.
# Trigger: workflow_dispatch. Requires repository secrets: LAMBDA_CLOUD_API_KEY, HUGGINGFACE_HUB_TOKEN.
# You must add an SSH key in Lambda Cloud (https://cloud.lambda.ai/ssh-keys) and pass its name as input.
name: Deploy to Lambda Cloud

on:
workflow_dispatch:
inputs:
instance_type_name:
description: "Lambda instance type (e.g. gpu_1x_a100)"
required: true
default: "gpu_1x_a100"
region_name:
description: "Lambda region (e.g. us-tx-1)"
required: true
default: "us-tx-1"
ssh_key_name:
description: "Name of SSH key already added in Lambda Cloud"
required: true

env:
LAMBDA_API_BASE: "https://cloud.lambdalabs.com/api/v1"

jobs:
build-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push kernelport (GPU)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.gpu
push: true
tags: ghcr.io/${{ github.repository_owner }}/kernelport:gpu,ghcr.io/${{ github.repository_owner }}/kernelport:gpu-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push kernelport-luxtts (GPU)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.luxtts
push: true
tags: ghcr.io/${{ github.repository_owner }}/kernelport-luxtts:gpu,ghcr.io/${{ github.repository_owner }}/kernelport-luxtts:gpu-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

launch:
needs: build-push
runs-on: ubuntu-latest
steps:
- name: List instance types (optional)
run: |
curl -sSf -u "${{ secrets.LAMBDA_CLOUD_API_KEY }}:" \
"${{ env.LAMBDA_API_BASE }}/instance-types" | jq -r '.data | keys[]' | head -20

- name: Launch instance
id: launch
run: |
body=$(jq -n \
--arg region "${{ github.event.inputs.region_name }}" \
--arg type "${{ github.event.inputs.instance_type_name }}" \
--arg key "${{ github.event.inputs.ssh_key_name }}" \
'{region_name: $region, instance_type_name: $type, ssh_key_names: [$key]}')
resp=$(curl -sSf -u "${{ secrets.LAMBDA_CLOUD_API_KEY }}:" \
-X POST "${{ env.LAMBDA_API_BASE }}/instance-operations/launch" \
-H "Content-Type: application/json" \
-d "$body")
echo "instance_ids=$(echo "$resp" | jq -r '.data.instance_ids[0]')" >> $GITHUB_OUTPUT
echo "$resp" | jq .

- name: Poll until instance is active
id: poll
run: |
id="${{ steps.launch.outputs.instance_ids }}"
for i in $(seq 1 30); do
resp=$(curl -sSf -u "${{ secrets.LAMBDA_CLOUD_API_KEY }}:" \
"${{ env.LAMBDA_API_BASE }}/instances/$id")
status=$(echo "$resp" | jq -r '.data.status')
ip=$(echo "$resp" | jq -r '.data.ip // empty')
echo "Attempt $i: status=$status ip=$ip"
if [ "$status" = "active" ] && [ -n "$ip" ]; then
echo "instance_ip=$ip" >> $GITHUB_OUTPUT
echo "Instance is up at $ip"
exit 0
fi
sleep 20
done
echo "Instance did not become active in time"
exit 1

- name: Smoke test (grpcurl)
continue-on-error: true
run: |
ip="${{ steps.poll.outputs.instance_ip }}"
if [ -z "$ip" ]; then exit 0; fi
# Instance may not have the stack running yet; user can SSH and run docker compose
if command -v grpcurl >/dev/null 2>&1; then
grpcurl -plaintext -connect-timeout 5 "$ip:50051" list || true
else
echo "grpcurl not installed; skip smoke test. Endpoint: $ip:50051"
fi

- name: Summary
run: |
echo "## Lambda Cloud instance" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Instance ID**: ${{ steps.launch.outputs.instance_ids }}" >> $GITHUB_STEP_SUMMARY
echo "- **IP**: ${{ steps.poll.outputs.instance_ip }}" >> $GITHUB_STEP_SUMMARY
echo "- **gRPC endpoint**: ${{ steps.poll.outputs.instance_ip }}:50051 (after you deploy the stack on the instance)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "SSH into the instance and run your stack (e.g. docker compose). Set \`HUGGINGFACE_HUB_TOKEN\` when running the LuxTTS worker." >> $GITHUB_STEP_SUMMARY
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ target
*.onnx
!models/identity.onnx

# Editor / IDE
.vscode/

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ repos:
language: system
types: [rust]
pass_filenames: false

- id: cargo-test
name: cargo test
entry: cargo test --all
language: system
pass_filenames: false

- id: python-scripts
name: Python script tests (manifest_to_serve_args)
entry: python tests/test_manifest_serve_args.py
language: system
pass_filenames: false
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
"crates/kernelport-core",
"crates/kernelport-runtime",
"crates/kernelport-backend-ort",
"crates/kernelport-backend-helion",
"crates/kernelport-proto",
"crates/kernelport-server",
]

32 changes: 32 additions & 0 deletions Dockerfile.helion
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
python3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

RUN curl -LsSf https://astral.sh/uv/install.sh | sh

ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:/root/.cargo/bin:${PATH}"

RUN uv venv /opt/venv \
&& uv pip install \
"torch==2.9.*" \
--index-url https://download.pytorch.org/whl/cu126 \
&& uv pip install \
helion \
grpcio \
grpcio-tools \
numpy

WORKDIR /app
COPY scripts/helion /app/scripts/helion
COPY crates/kernelport-proto/src /app/crates/kernelport-proto/src

EXPOSE 50061

CMD ["python", "/app/scripts/helion/helion_worker.py", "--addr", "0.0.0.0:50061", "--device", "cuda"]
25 changes: 25 additions & 0 deletions Dockerfile.helion.mock
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.11-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN curl -LsSf https://astral.sh/uv/install.sh | sh

ENV PATH="/root/.local/bin:/root/.cargo/bin:${PATH}"

WORKDIR /app
COPY scripts/helion /app/scripts/helion
COPY crates/kernelport-proto/src /app/crates/kernelport-proto/src

RUN /root/.local/bin/uv venv /app/.venv \
&& . /app/.venv/bin/activate \
&& /root/.local/bin/uv pip install numpy grpcio grpcio-tools

ENV PATH="/app/.venv/bin:${PATH}"

EXPOSE 50061

CMD ["python", "/app/scripts/helion/mock/helion_worker_mock.py", "--addr", "0.0.0.0:50061"]
38 changes: 38 additions & 0 deletions Dockerfile.luxtts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# LuxTTS gRPC worker (Helion-style sidecar). Loads YatharthS/LuxTTS from HF.
# Uses uv for consistency with Dockerfile.helion.
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
python3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

RUN curl -LsSf https://astral.sh/uv/install.sh | sh

ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:/root/.local/bin:${PATH}"

WORKDIR /app

# Clone LuxTTS so zipvoice.luxvoice is available; install its deps with uv
RUN git clone --depth 1 https://github.com/ysharma3501/LuxTTS.git /app/LuxTTS
RUN uv venv /opt/venv \
&& uv pip install -r /app/LuxTTS/requirements.txt

# gRPC and proto for kernelport InferenceService
RUN uv pip install grpcio grpcio-tools

COPY scripts/luxtts /app/scripts/luxtts
COPY crates/kernelport-proto/src /app/crates/kernelport-proto/src

ENV LUXTTS_REPO=/app/LuxTTS
ENV KERNELPORT_REPO_ROOT=/app
ENV PYTHONPATH=/app/LuxTTS:/app

EXPOSE 50061

CMD ["python", "/app/scripts/luxtts/luxtts_worker.py", "--addr", "0.0.0.0:50061", "--device", "cuda"]
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DEFAULT_GOAL := help
.PHONY: fmt clippy test build check run help
.PHONY: fmt clippy test test-python build check run help

PROJECT_NAME := kernelport
PROJECT_VERSION := $(shell cargo pkgid -p kernelport-server 2>/dev/null | sed -E 's/.*@//')
Expand All @@ -16,10 +16,13 @@ clippy:
test:
cargo test --all

test-python:
python3 tests/test_manifest_serve_args.py

build:
cargo build --all

check: fmt clippy test build
check: fmt clippy test test-python build

run:
RUST_LOG=info cargo run -p kernelport-server
Expand All @@ -28,9 +31,10 @@ help:
@printf "%s\n" \
"$(PROJECT_NAME) $(PROJECT_VERSION)" \
"Targets:" \
" fmt - Run rustfmt" \
" clippy - Run clippy with warnings denied" \
" test - Run tests" \
" build - Build all crates" \
" check - Run fmt, clippy, test, build" \
" run - Run kernelport-server"
" fmt - Run rustfmt" \
" clippy - Run clippy with warnings denied" \
" test - Run Rust tests" \
" test-python - Run Python script tests (manifest_to_serve_args)" \
" build - Build all crates" \
" check - Run fmt, clippy, test, test-python, build" \
" run - Run kernelport-server"
Loading