code: def create_collective_group(
      actors,
      world_size: int,
      ranks: List[int],
      backend=types.Backend.NCCL,
      group_name: str = "default",
  ):
      """Declare a list of actors as a collective group.
  
      Note: This function should be called in a driver process.
  
      Args:
          actors: a list of actors to be set in a collective group.
          world_size: the total number of processes in the group.
          ranks (List[int]): the rank of each actor.
          backend: the CCL backend to use, NCCL or GLOO.
          group_name: the name of the collective group.
  
      Returns:
          None
      """
      backend = types.Backend(backend)
      _check_backend_availability(backend)
  
      name = "info_" + group_name
      try:
          ray.get_actor(name)
          raise RuntimeError("Trying to initialize a group twice.")
      except ValueError:
          pass
  
      if len(ranks) != len(actors):
          raise RuntimeError(
              "Each actor should correspond to one rank. Got '{}' "
              "ranks but '{}' actors".format(len(ranks), len(actors))
          )
  
      if set(ranks) != set(range(len(ranks))):
          raise RuntimeError(
              "Ranks must be a permutation from 0 to '{}'. Got '{}'.".format(
                  len(ranks), "".join([str(r) for r in ranks])
              )
          )
  
      if world_size <= 0:
          raise RuntimeError(
              "World size must be greater than zero. Got '{}'.".format(
                  world_size
              )
          )
      if not all(ranks) >= 0:
          raise RuntimeError("Ranks must be non-negative.")
      if not all(ranks) < world_size:
          raise RuntimeError("Ranks cannot be greater than world_size.")
  
      # avoid a circular dependency
      from ray.util.collective.util import Info
  
      # store the information into a NamedActor that can be accessed later.
      name = "info_" + group_name
      actors_id = [a._ray_actor_id for a in actors]
      # TODO (Dacheng): how do we recycle this name actor?
      info = Info.options(name=name, lifetime="detached").remote()
      ray.get(
          [info.set_info.remote(actors_id, world_size, ranks, backend)]
      )
  
imports: import logging
  import os
  from typing import List
  import numpy
  import ray
  from ray.util.collective import types
label_desc: Use image node_id 5 for calling a global function with example usage: create_collective_group(actors, world_size, ranks, backend, group_name) without return types