# transformers 5.24.1 (Apache-2.0), harvested by tools/harvest_corpus.py
=== input

    Wraps a model with XLA Fully Sharded Data Parallelism (FSDP).

    Handles both FSDP v1 (`XlaFullyShardedDataParallel`) and v2 (`SpmdFullyShardedDataParallel`),
    including auto-wrap policies, gradient checkpointing, and patching `xm.optimizer_step`.

    Args:
        model (`torch.nn.Module`): The model to wrap.
        args (`TrainingArguments`): The training arguments containing FSDP configuration.
        is_fsdp_xla_v2_enabled (`bool`): Whether FSDP v2 (SPMD) is enabled.

    Returns:
        `torch.nn.Module`: The FSDP-wrapped model.
    
=== parse google
short_description: 'Wraps a model with XLA Fully Sharded Data Parallelism (FSDP).'
long_description: |
  Handles both FSDP v1 (`XlaFullyShardedDataParallel`) and v2 (`SpmdFullyShardedDataParallel`),
  including auto-wrap policies, gradient checkpointing, and patching `xm.optimizer_step`.
blank_after_short_description: True
blank_after_long_description: True
style: google
- DocstringParam
  description: 'The model to wrap.'
  kind: param
  key: 'param'
  arg_name: 'model'
  type_name: '`torch.nn.Module`'
  is_optional: False
- DocstringParam
  description: 'The training arguments containing FSDP configuration.'
  kind: param
  key: 'param'
  arg_name: 'args'
  type_name: '`TrainingArguments`'
  is_optional: False
- DocstringParam
  description: 'Whether FSDP v2 (SPMD) is enabled.'
  kind: param
  key: 'param'
  arg_name: 'is_fsdp_xla_v2_enabled'
  type_name: '`bool`'
  is_optional: False
- DocstringReturns
  description: 'The FSDP-wrapped model.'
  kind: returns
  key: 'returns'
  type_name: '`torch.nn.Module`'
  is_generator: False
=== detect
google
=== compose google
Wraps a model with XLA Fully Sharded Data Parallelism (FSDP).

Handles both FSDP v1 (`XlaFullyShardedDataParallel`) and v2 (`SpmdFullyShardedDataParallel`),
including auto-wrap policies, gradient checkpointing, and patching `xm.optimizer_step`.

Args:
    model (`torch.nn.Module`): The model to wrap.
    args (`TrainingArguments`): The training arguments containing FSDP configuration.
    is_fsdp_xla_v2_enabled (`bool`): Whether FSDP v2 (SPMD) is enabled.

Returns:
    `torch.nn.Module`: The FSDP-wrapped model.
