Initialize role_maker in Fleet. This function is responsible for the distributed architecture what you want to run your code behind. Args: role_maker (RoleMakerBase, optional): A ``RoleMakerBase`` containing the configuration of environm
(
self,
role_maker: RoleMakerBase | None = None,
is_collective: bool = False,
strategy: DistributedStrategy | None = None,
log_level: int | str = "INFO",
)
| 218 | self.user_defined_optimizer: Optimizer = paddle.optimizer.Optimizer(0.0) |
| 219 | |
| 220 | def init( |
| 221 | self, |
| 222 | role_maker: RoleMakerBase | None = None, |
| 223 | is_collective: bool = False, |
| 224 | strategy: DistributedStrategy | None = None, |
| 225 | log_level: int | str = "INFO", |
| 226 | ) -> Self: |
| 227 | """ |
| 228 | Initialize role_maker in Fleet. |
| 229 | |
| 230 | This function is responsible for the distributed architecture |
| 231 | what you want to run your code behind. |
| 232 | |
| 233 | Args: |
| 234 | role_maker (RoleMakerBase, optional): A ``RoleMakerBase`` containing the configuration |
| 235 | of environment variables related to distributed training.If you did not initialize |
| 236 | the rolemaker by yourself, it will be automatically initialized to PaddleRoleMaker. |
| 237 | The default value is None. |
| 238 | is_collective (Boolean, optional): A ``Boolean`` variable determines whether the program |
| 239 | runs on Collective mode or ParameterServer mode. True means the program runs on |
| 240 | Collective mode, and False means running on ParameterServer mode. The default value |
| 241 | is False. |
| 242 | strategy (DistributedStrategy): Extra properties for distributed training. |
| 243 | For details, please refer to paddle.distributed.fleet.DistributedStrategy. Default: None. |
| 244 | log_level (Integer, String, optional): A ``Integer`` or ``String`` Variable determining how height |
| 245 | the logging level is. Default is "INFO". |
| 246 | |
| 247 | Returns: |
| 248 | None |
| 249 | |
| 250 | Examples: |
| 251 | .. code-block:: pycon |
| 252 | :name: code-init-example1 |
| 253 | |
| 254 | >>> import paddle.distributed.fleet as fleet |
| 255 | >>> fleet.init() |
| 256 | |
| 257 | .. code-block:: pycon |
| 258 | :name: code-init-example2 |
| 259 | |
| 260 | >>> import paddle.distributed.fleet as fleet |
| 261 | >>> fleet.init(is_collective=True) |
| 262 | |
| 263 | .. code-block:: pycon |
| 264 | :name: code-init-example3 |
| 265 | |
| 266 | >>> import paddle.distributed.fleet as fleet |
| 267 | >>> role = fleet.PaddleCloudRoleMaker() |
| 268 | >>> fleet.init(role) |
| 269 | |
| 270 | .. code-block:: pycon |
| 271 | :name: code-init-example4 |
| 272 | |
| 273 | >>> import paddle.distributed.fleet as fleet |
| 274 | >>> strategy = fleet.DistributedStrategy() |
| 275 | >>> fleet.init(strategy=strategy) |
| 276 | |
| 277 | .. code-block:: pycon |