- class ray.air.ScalingConfig(trainer_resources: Optional[Union[Dict, Domain, Dict[str, List]]] = None, num_workers: Optional[Union[int, Domain, Dict[str, List]]] = None, use_gpu: Union[bool, Domain, Dict[str, List]] = False, resources_per_worker: Optional[Union[Dict, Domain, Dict[str, List]]] = None, placement_strategy: Union[str, Domain, Dict[str, List]] = 'PACK', _max_cpu_fraction_per_node: Optional[Union[float, Domain, Dict[str, List]]] = None)[source]#
Configuration for scaling training.
trainer_resources – Resources to allocate for the trainer. If None is provided, will default to 1 CPU.
num_workers – The number of workers (Ray actors) to launch. Each worker will reserve 1 CPU by default. The number of CPUs reserved by each worker can be overridden with the
use_gpu – If True, training will be done on GPUs (1 per worker). Defaults to False. The number of GPUs reserved by each worker can be overridden with the
resources_per_worker – If specified, the resources defined in this Dict will be reserved for each worker. The
GPUkeys (case-sensitive) can be defined to override the number of CPU/GPUs used by each worker.
placement_strategy – The placement strategy to use for the placement group of the Ray actors. See Placement Group Strategies for the possible options.
_max_cpu_fraction_per_node – [Experimental] The max fraction of CPUs per node that Train will use for scheduling training actors. The remaining CPUs can be used for dataset tasks. It is highly recommended that you set this to less than 1.0 (e.g., 0.8) when passing datasets to trainers, to avoid hangs / CPU starvation of dataset tasks. Warning: this feature is experimental and is not recommended for use with autoscaling (scale-up will not trigger properly).
PublicAPI (beta): This API is in beta and may change before becoming stable.
- property total_resources#
Map of total resources required for the trainer.
- property num_cpus_per_worker#
The number of CPUs to set per worker.
- property num_gpus_per_worker#
The number of GPUs to set per worker.
- property additional_resources_per_worker#
Resources per worker, not including CPU or GPU resources.
- as_placement_group_factory() PlacementGroupFactory [source]#
Returns a PlacementGroupFactory to specify resources for Tune.
- classmethod from_placement_group_factory(pgf: PlacementGroupFactory) ScalingConfig [source]#
Create a ScalingConfig from a Tune’s PlacementGroupFactory