bagua.torch_api.algorithms.decentralized

Module Contents

class bagua.torch_api.algorithms.decentralized.DecentralizedAlgorithm(hierarchical=True, peer_selection_mode='all', communication_interval=1)

Bases: bagua.torch_api.algorithms.Algorithm

Create an instance of the Decentralized SGD algorithm.

Parameters
  • hierarchical (bool) – Enable hierarchical communication.

  • peer_selection_mode (str) – Can be "all" or "shift_one". "all" means all workers’ weights are averaged in each communication step. "shift_one" means each worker selects a different peer to do weights average in each communication step.

  • communication_interval (int) – Number of iterations between two communication steps.

tensors_to_buckets(self, tensors)
Parameters

tensors (List[List[bagua.torch_api.tensor.BaguaTensor]]) –

Return type

List[bagua.torch_api.bucket.BaguaBucket]

class bagua.torch_api.algorithms.decentralized.LowPrecisionDecentralizedAlgorithm(hierarchical=True, communication_interval=1)

Bases: bagua.torch_api.algorithms.Algorithm

Create an instance of the Low Precision Decentralized SGD algorithm.

Parameters
  • hierarchical (bool) – Enable hierarchical communication.

  • communication_interval (int) – Number of iterations between two communication steps.