def auto_scale_config(cfg, world):
    """
    Method automatically scales learning rate
    based on number of processes in distributed cluster.
    
    When scaling, we take user-provided config as a config for single node with 8 GPUs
    and scale it based on total number of training processes.
    
    Note, that batch size is not scaled, as MMDetection uses relative
    batch size: cfg.data.samples_per_gpu
    """
    
    old_world_size = 8 # Note, this is a hardcoded value, as MMDetection configs are build for single 8-GPU V100 node.
    old_lr = cfg.optimizer.lr
    old_lr_warmup = cfg.lr_config.warmup_iters
    scale = world["size"] / old_world_size
    
    cfg.optimizer.lr = old_lr * scale
    cfg.lr_config.warmup_iters = old_lr_warmup / scale
    
    print(f"""Initial learning rate {old_lr} and warmup {old_lr_warmup} were scaled \
          to {cfg.optimizer.lr} and {cfg.lr_config.warmup_iters} respectively.
          Each GPU has batch size of {cfg.data.samples_per_gpu},
          Total number of GPUs in training cluster is {world['size']}.
          Effective batch size is {cfg.data.samples_per_gpu * world['size']}""")
    
    return cfg