+
    $LjS	                     X    ^ RI Ht ^ RIHt RtR tR	R ltR t]R8X  d
   ]! 4        R# R# )
    )CustomArgumentParser)merge_fsdp_weightsa!  Utility to merge the weights from multiple FSDP checkpoints into a single combined checkpoint. Should be used if
`SHARDED_STATE_DICT` was used for the model. Weights will be saved to `{output_path}`.

This is a CPU-bound process and requires enough RAM to load the entire model state dict.c                 |    \        V P                  V P                  V P                  '       * V P                  4       R # N)r   checkpoint_directoryoutput_pathunsafe_serializationremove_checkpoint_dir)argss   &E/app/.local/lib/python3.14/site-packages/accelerate/commands/merge.pymerge_commandr      s/    !!4#3#39R9R5RTXTnTn    Nc                 F   V e   V P                  R\        R7      pM\        \        R7      pVP                  R\        RR7       VP                  R\        RR7       VP                  RR	R
RR7       VP                  RR	RR
R7       V e   VP                  \        R7       V# )Nzmerge-weights)descriptionr   z5A directory containing sharded weights saved by FSDP.)typehelpr   zHThe path to save the merged weights. Defaults to the current directory. z--unsafe_serialization
store_trueFzZWhether to save the merged weights as `.bin` rather than `.safetensors` (not recommended).)actiondefaultr   z--remove_checkpoint_dirz9Whether to remove the checkpoint directory after merging.)r   r   r   )func)
add_parserr   r   add_argumentstrset_defaultsr   )
subparsersparsers   & r   merge_command_parserr       s    &&K&P%+>
.S?vw
W  
  i	   !H	   /Mr   c                  P    \        4       p V P                  4       p\        V4       R # r   )r   
parse_argsr   )r   r   s     r   mainr    >   s     !#FD$r   __main__r   )	accelerate.commands.utilsr   accelerate.utilsr   r   r   r   r    __name__ r   r   <module>r&      s8     ; /\< zF r   