UserDefinedRoleMaker

class paddle.distributed.fleet.UserDefinedRoleMaker [源代码]

UserDefinedRoleMaker是基于从用户自定义的参数中获取分布式相关信息进行分布式配置初始化的接口 它会自动根据用户的自定义配置进行分布式训练环境初始化,目前UserDefinedRoleMaker支持ParameterServer分布式训练及Collective分布式训练两种模式的初始化。

代码示例

  1. import paddle.distributed.fleet as fleet
  2. from paddle.distributed.fleet.base.role_maker import Role
  3. fleet.UserDefinedRoleMaker(
  4. current_id=0,
  5. role=Role.SERVER,
  6. worker_num=2,
  7. server_endpoints=["127.0.0.1:36011", "127.0.0.1:36012"])

to_string ( )

将当前环境变量以字符串的形式输出

返回: string

代码示例:

  1. import paddle.distributed.fleet as fleet
  2. from paddle.distributed.fleet.base.role_maker import Role
  3. role = fleet.UserDefinedRoleMaker(
  4. current_id=0,
  5. role=Role.SERVER,
  6. worker_num=2,
  7. server_endpoints=["127.0.0.1:36011", "127.0.0.1:36012"])
  8. role.to_string()