Adding torch accelerator and requirements file to FSDP2 example #1375
+46 −8
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Adding torch accelerator support to FSDP2 example and
Updates to FSDP2 example:
Script Renaming and Documentation Updates:
train.pytoexample.pyand updated references inREADME.mdto reflect the new filename. Added instructions to install dependencies viarequirements.txtbefore running the example.GPU Verification and Device Initialization:
verify_min_gpu_countfunction to ensure at least two GPUs are available before running the example.main()to dynamically detect and configure the device type usingtorch.accelerator. This improves compatibility with different hardware setups.New supporting files:
Dependency Management:
requirements.txtfile listing required dependencies (torch>=2.7andnumpy).Script for Running Examples:
run_example.shto simplify launching FSDP2 example.Integration into Distributed Examples:
distributed_FSDP2inrun_distributed_examples.shto include the FSDP2 example in the distributed testing workflow.CC: @msaroufim @malfet @dvrogozh