mlx.nn.layers.distributed.fully_shard

目錄

mlx.nn.layers.distributed.fully_shard#

fully_shard(module: Module, *, group: Group | None = None, compute_dtype: Dtype | None = None) → Module#

Wrap module in a FullyShardedModule.

參數:
  • module (Module) -- The module to wrap.

  • group (Group, optional) -- The group to shard across. If not set, the global group is used. Default: None.

  • compute_dtype (Dtype, optional) -- If set, the gathered parameters are cast to this dtype for the forward pass. Default: None.

回傳值:

The wrapped FullyShardedModule, or module unchanged.