Skip to content

Commit 6deeda9

Browse files
authored
LoRA FSDP2 recipe migration (#1517)
1 parent 515efbe commit 6deeda9

File tree

13 files changed

+175
-1422
lines changed

13 files changed

+175
-1422
lines changed

docs/source/tutorials/memory_optimizations.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,3 @@ to see how to configure.
321321
322322
.. All our ``_distributed`` recipes use `FSDP <https://pytorch.org/docs/stable/fsdp.html>`.
323323
.. .. _glossary_fsdp2:
324-
325-
.. (Experimental) Fully Sharded Data Parallel 2 (FSDP2)
326-
.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
327-
.. This directory contains distributed training recipes for LoRA and QLoRA using `FSDP2 <https://github.com/pytorch/pytorch/issues/114299>`_.
328-
.. Currently FSDP2 is only available in PyTorch nightly releases.

recipes/configs/dev/llama2/13B_lora_fsdp2.yaml

Lines changed: 0 additions & 91 deletions
This file was deleted.

recipes/configs/dev/llama2/70B_lora_fsdp2.yaml

Lines changed: 0 additions & 91 deletions
This file was deleted.

recipes/configs/dev/llama2/7B_lora_fsdp2.yaml

Lines changed: 0 additions & 88 deletions
This file was deleted.

recipes/configs/dev/llama2/70B_qlora_fsdp2.yaml renamed to recipes/configs/llama2/70B_qlora.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Config for multi-device QLoRA in lora_finetune_fsdp2.py
1+
# Config for multi-device QLoRA in lora_finetune_distributed.py
22
# using a Llama2 70B model
33
#
4-
# This config requires PyTorch nightlies to run.
5-
# See https://github.com/pytorch/torchtune/blob/main/recipes/dev/fsdp2_recipes.md
6-
# for setup instructions.
7-
#
84
# This config assumes that you've run the following command before launching
95
# this run:
106
# tune download meta-llama/Llama-2-70b-hf --output-dir /tmp/Llama-2-70b-hf --hf-token <HF_TOKEN>
117
#
128
# This config needs 8 GPUs to run
13-
# # tune run --nproc_per_node 8 lora_finetune_fsdp2 --config llama2/70B_qlora
9+
# # tune run --nproc_per_node 8 lora_finetune_distributed --config llama2/70B_qlora
10+
#
11+
# You can add specific overrides through the command line. For example
12+
# to override the checkpointer directory while launching training
13+
# you can run:
14+
# tune run --nproc_per_node 8 lora_finetune_distributed --config llama2/70B_qlora checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
1415
#
1516

1617
# Model Arguments

recipes/configs/dev/llama2/7B_qlora_fsdp2.yaml renamed to recipes/configs/llama2/7B_qlora.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
# Config for single device QLoRA with lora_finetune_fsdp2.py
1+
# Config for single device QLoRA with lora_finetune_distributed.py
22
# using a Llama2 7B model
33
#
4-
# This config requires PyTorch nightlies to run.
5-
# See https://github.com/pytorch/torchtune/blob/main/recipes/dev/fsdp2_recipes.md
6-
# for setup instructions.
7-
#
84
# This config assumes that you've run the following command before launching
95
# this run:
106
# tune download meta-llama/Llama-2-7b-hf --output-dir /tmp/Llama-2-7b-hf --hf-token <HF_TOKEN>
117
#
128
# To launch on 2 devices, run the following command from root:
13-
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_fsdp2 --config llama2/7B_qlora
9+
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama2/7B_qlora
1410
#
1511
# You can add specific overrides through the command line. For example
1612
# to override the checkpointer directory while launching training
1713
# you can run:
18-
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_fsdp2 --config llama2/7B_qlora checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
14+
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama2/7B_qlora checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
1915
#
2016
# This config works best when the model is being fine-tuned on 2+ GPUs.
2117
# For single device LoRA finetuning please use 7B_lora_single_device.yaml

recipes/configs/dev/llama3/8B_dora_fsdp2.yaml renamed to recipes/configs/llama3/8B_dora.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Config for multi-device DoRA finetuning in lora_finetune_fsdp2.py
1+
# Config for multi-device DoRA finetuning in lora_finetune_distributed.py
22
# using a Llama3 8B Instruct model
33
#
44
# This config assumes that you've run the following command before launching
55
# this run:
66
# tune download meta-llama/Meta-Llama-3-8B-Instruct --output-dir /tmp/Meta-Llama-3-8B-Instruct --hf-token <HF_TOKEN>
77
#
88
# To launch on 2 devices, run the following command from root:
9-
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_fsdp2 --config llama3/8B_dora
9+
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama3/8B_dora
1010
#
1111
# You can add specific overrides through the command line. For example
1212
# to override the checkpointer directory while launching training
1313
# you can run:
14-
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_fsdp2 --config llama3/8B_dora checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
14+
# tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama3/8B_dora checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
1515

1616

1717
# Model Arguments
@@ -30,7 +30,7 @@ tokenizer:
3030
path: /tmp/Meta-Llama-3-8B-Instruct/original/tokenizer.model
3131

3232
checkpointer:
33-
_component_: torchtune.utils.FullModelMetaCheckpointer
33+
_component_: torchtune.training.FullModelMetaCheckpointer
3434
checkpoint_dir: /tmp/Meta-Llama-3-8B-Instruct/original/
3535
checkpoint_files: [
3636
consolidated.00.pth

recipes/dev/fsdp2_recipes.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)