Skip to content
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
121 changes: 121 additions & 0 deletions .github/workflows/modal-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Modal CI

on:
push:
branches: [main]
paths:
- 'trellis2_modal/**'
- '.github/workflows/modal-ci.yml'
pull_request:
branches: [main]
paths:
- 'trellis2_modal/**'
- '.github/workflows/modal-ci.yml'

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Run unit tests
run: |
uv run --with pytest --with lz4 --with numpy --with pillow --with modal --with fastapi --with requests \
pytest trellis2_modal/tests/ -v --tb=short

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Check formatting with ruff
run: |
uv run --with ruff ruff format --check trellis2_modal/

- name: Lint with ruff
run: |
uv run --with ruff ruff check trellis2_modal/

verify-image:
name: Verify Modal Image
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [test, lint]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install deploy dependencies
run: pip install -r trellis2_modal/requirements-deploy.txt

- name: Set up Modal credentials
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
run: |
modal token set --token-id "$MODAL_TOKEN_ID" --token-secret "$MODAL_TOKEN_SECRET"

- name: Verify image builds
run: modal run trellis2_modal/service/image.py
timeout-minutes: 30

deploy:
name: Deploy to Modal
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [verify-image]
environment: production

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install deploy dependencies
run: pip install -r trellis2_modal/requirements-deploy.txt

- name: Set up Modal credentials
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
run: |
modal token set --token-id "$MODAL_TOKEN_ID" --token-secret "$MODAL_TOKEN_SECRET"

- name: Deploy service
run: modal deploy -m trellis2_modal.service.service
timeout-minutes: 10

# Note: Health check removed because endpoint URL is dynamic
# Monitor deployment status in Modal dashboard instead
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,11 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

# Temporary test files
tmp/

# Modal credentials - NEVER commit these!
.trellis2_modal_secrets.json
*_secrets.json
*.secrets.json
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ Then, you can access the demo at the address shown in the terminal.

Will be released soon. Please stay tuned!

## ☁️ Cloud Deployment (Modal)

This fork adds support for deploying TRELLIS.2 to [Modal](https://modal.com/)'s serverless GPU infrastructure. Run image-to-3D generation without a local GPU:

- **No local GPU needed** - runs on cloud A100s
- **Pay-per-use** - ~$0.05 per generation
- **Web UI or API** - access from any device

```bash
# Deploy to Modal
modal deploy -m trellis2_modal.service.service

# Run the local client
python -m trellis2_modal.client.app
```

See **[trellis2_modal/README.md](trellis2_modal/README.md)** for setup instructions.


## 🧩 Related Packages

TRELLIS.2 is built upon several specialized high-performance packages developed by our team:
Expand Down
Loading