Resources
The Resources dataclass defines compute requirements for processing stages.
Import
Class Definition
Properties
requires_gpu
Check if any GPU resources are requested.
Usage Examples
CPU-Only Stage
Single-GPU Stage
Use gpu_memory_gb for stages that need a fraction of a GPU:
The system automatically calculates the GPU fraction based on available GPU memory.
Multi-GPU Stage
Use gpus for stages that need one or more full GPUs:
Entire GPU Allocation
Use entire_gpu: True to allocate a full GPU regardless of memory:
Important Constraints
You cannot specify both gpus and gpu_memory_gb. Choose one:
- Use
gpu_memory_gbfor single-GPU stages (< 1 GPU) - Use
gpusfor multi-GPU stages (>= 1 GPU)
Using Resources with Stages
Configuring Resources at Runtime
Use with_() to override resource configurations: