class_docstr: Ensures that the workers are balanced across all hosts.
class_docstr_tok: ["Ensures","that","the","workers","are","balanced","across","all","hosts","."]
code: def __init__(
      self,
      *,
      settings,
      num_hosts: int,
      num_workers_per_host: int,
      use_gpu: bool,
      cpus_per_worker: int,
      gpus_per_worker: int,
  ):
      self.settings = settings
      self.num_hosts = num_hosts
      self.num_workers_per_host = num_workers_per_host
      self.use_gpu = use_gpu
      self.cpus_per_worker = cpus_per_worker
      self.gpus_per_worker = gpus_per_worker or 1
  
imports: from collections import defaultdict
  import logging
  from typing import Dict
  import ray
  from ray.util.placement_group import get_current_placement_group
  from horovod.ray.utils import map_blocking
  from horovod.ray.worker import BaseHorovodWorker
label_desc: Use image node_id 1 to create a new ColocatedStrategy object from inherited base classes: BaseStrategy with example: obj = ColocatedStrategy()