def METHOD_NAME(local_rank, world_size, ctx):
    # Get RPC configuration options from model YAML config
    rpc_timeout = ctx.model_yaml_config["pippy"]["rpc_timeout"]
    num_worker_threads = ctx.model_yaml_config["pippy"]["num_worker_threads"]
    options = rpc.TensorPipeRpcBackendOptions(
        num_worker_threads=num_worker_threads, rpc_timeout=rpc_timeout
    )
    # Set up device mapping for RPC workers
    n_devs = torch.cuda.device_count()
    dev_id = local_rank % n_devs
    for i in range(world_size):
        options.set_device_map(f"worker{i}", {dev_id: i % n_devs})
    # Initialize RPC worker
    logger.info(f"rank = {local_rank} pid/device = " f"{os.getpid()}/{dev_id}")
    rpc.init_rpc(
        f"worker{local_rank}",
        rank=local_rank,
        world_size=world_size,
        rpc_backend_options=options,
    )