Add GitHub Action for running GPU tests on Modal#21
Conversation
- Created Modal app configuration (llamax/ci_gpu.py) to run GPU tests - Added GitHub Actions workflow (.github/workflows/gpu_test.yml) that triggers tests on Modal - Included example GPU test file (llamax/example_gpu.py) to demonstrate the pattern - Tests filter for files with 'gpu' in the name or path - Requires MODAL_TOKEN_ID and MODAL_TOKEN_SECRET to be set in GitHub secrets The workflow can be triggered on push/PR to main or manually via workflow_dispatch.
- Replace pip with uv in Modal image setup - Install uv via official install script - Use uv sync to install dependencies from pyproject.toml - Run pytest via uv run for proper environment isolation - Add modal>=0.64.0 as dev dependency in pyproject.toml This aligns with the existing test workflow pattern and improves dependency management consistency across the project.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @app.local_entrypoint() | ||
| def main(): | ||
| """Main entrypoint for running GPU tests locally via Modal.""" | ||
| return run_gpu_tests.remote() |
There was a problem hiding this comment.
Wait for Modal test job to finish
The local entrypoint returns run_gpu_tests.remote() without ever awaiting the remote function. remote() launches the Modal job asynchronously and immediately returns a FunctionCall handle; the CLI process then exits with success regardless of the job’s outcome. As written the GitHub workflow can report success even if the GPU tests fail (or never start), leaving the tests non-blocking. Use run_gpu_tests.call() or run_gpu_tests.remote().get() so the action fails when the remote pytest run fails.
Useful? React with 👍 / 👎.
- Replace manual uv installation with Modal's pip_install_from_pyproject - Automatically installs dependencies from pyproject.toml including dev extras - Cleaner, more maintainable configuration - Run pytest directly without uv wrapper
Modal changes: - Use Modal's built-in uv_sync method for dependency management - Automatically syncs dependencies from pyproject.toml with dev extras - Cleaner and more idiomatic Modal configuration GitHub Action changes: - Replace pip with uv in workflow - Use uv sync --extra dev to install dependencies - Run modal via uv run for consistency
- Created scripts/run_gpu_tests.sh for running GPU tests on Modal - Updated Modal configuration to support GPU type selection (any, h100, a100) - Added test filter support to run specific test patterns - Added scripts/README.md with usage documentation - Updated pyproject.toml with pytest config to exclude Modal CI files - Maintained backward compatibility for GitHub Actions workflow Usage: ./scripts/run_gpu_tests.sh # Run all GPU tests ./scripts/run_gpu_tests.sh --gpu=h100 # Run on H100 ./scripts/run_gpu_tests.sh --gpu=a100 pattern # Run filtered tests on A100
- Changed uv_sync parameter from local_path to uv_project_dir - Removed deprecated Mount API, use add_local_python_source instead - Removed required=False parameter from Secret.from_name() (not supported) - Updated pytest paths to use "llamax" instead of absolute paths - Removed unnecessary cwd parameter in subprocess calls These changes align with Modal v1.3+ API requirements.
The workflow can be triggered on push/PR to main or manually via workflow_dispatch.