Modal runs Python code on serverless infrastructure. GPU instances spin up in seconds. Pay only for compute time. Container-based isolation.
Function Definition
Decorate functions to run on Modal. Specify container images and resources. Schedule functions or expose as endpoints. Share state between calls.
- Define functions with @stub.function decorator
- Specify GPU requirements
- Use custom container images
- Create web endpoints with @stub.web_endpoint
- Schedule periodic execution
AI Workloads
Fast GPU cold starts for inference. Training jobs with checkpointing. Batch processing at scale. Cost-effective spot instances.