-
Notifications
You must be signed in to change notification settings - Fork 178
Update Axolotl Examples #2502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Axolotl Examples #2502
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,13 +161,18 @@ To request multiple GPUs, specify the quantity after the GPU name, separated by | |
|
||
```yaml | ||
type: task | ||
# The name is optional, if not specified, generated randomly | ||
name: axolotl-amd-llama31-train | ||
|
||
# Using RunPod's ROCm Docker image | ||
image: runpod/pytorch:2.1.2-py3.10-rocm6.0.2-ubuntu22.04 | ||
# Required environment variables | ||
env: | ||
- HF_TOKEN | ||
- WANDB_API_KEY | ||
- WANDB_PROJECT | ||
- WANDB_NAME=axolotl-amd-llama31-train | ||
- HUB_MODEL_ID | ||
# Commands of the task | ||
commands: | ||
- export PATH=/opt/conda/envs/py_3.10/bin:$PATH | ||
|
@@ -177,6 +182,9 @@ To request multiple GPUs, specify the quantity after the GPU name, separated by | |
- cd axolotl | ||
- git checkout d4f6c65 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this particular revision?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then a comment is needed I suppose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I will update it accordingly. |
||
- pip install -e . | ||
# Latest pynvml is not compatible with axolotl commit d4f6c65, so we need to fall back to version 11.5.3 | ||
- pip uninstall pynvml -y | ||
- pip install pynvml==11.5.3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a note or at least a comment on it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I will add. |
||
- cd .. | ||
- wget https://dstack-binaries.s3.amazonaws.com/flash_attn-2.0.4-cp310-cp310-linux_x86_64.whl | ||
- pip install flash_attn-2.0.4-cp310-cp310-linux_x86_64.whl | ||
|
@@ -190,18 +198,18 @@ To request multiple GPUs, specify the quantity after the GPU name, separated by | |
- make | ||
- pip install . | ||
- cd .. | ||
- accelerate launch -m axolotl.cli.train axolotl/examples/llama-3/fft-8b.yaml | ||
|
||
# Uncomment to leverage spot instances | ||
#spot_policy: auto | ||
- accelerate launch -m axolotl.cli.train -- axolotl/examples/llama-3/fft-8b.yaml | ||
--wandb-project "$WANDB_PROJECT" | ||
--wandb-name "$WANDB_NAME" | ||
--hub-model-id "$HUB_MODEL_ID" | ||
|
||
resources: | ||
gpu: MI300X | ||
disk: 150GB | ||
``` | ||
</div> | ||
|
||
Note, to support ROCm, we need to checkout to commit `d4f6c65`. You can find the installation instruction in [rocm-blogs :material-arrow-top-right-thin:{ .external }](https://github.com/ROCm/rocm-blogs/blob/release/blogs/artificial-intelligence/axolotl/src/Dockerfile.rocm){:target="_blank"}. | ||
Note, to support ROCm, we need to checkout to commit `d4f6c65`. This commit eliminates the need to manually modify the Axolotl source code to make xformers compatible with ROCm, as described in the [xformers workaround :material-arrow-top-right-thin:{ .external }](https://docs.axolotl.ai/docs/amd_hpc.html#apply-xformers-workaround). This installation approach is also followed for building Axolotl ROCm docker image. [(See Dockerfile) :material-arrow-top-right-thin:{ .external }](https://github.com/ROCm/rocm-blogs/blob/release/blogs/artificial-intelligence/axolotl/src/Dockerfile.rocm){:target="_blank"}. | ||
|
||
> To speed up installation of `flash-attention` and `xformers `, we use pre-built binaries uploaded to S3. | ||
> You can find the tasks that build and upload the binaries | ||
|
@@ -216,6 +224,10 @@ cloud resources and run the configuration. | |
|
||
```shell | ||
$ HF_TOKEN=... | ||
$ WANDB_API_KEY=... | ||
$ WANDB_PROJECT=... | ||
$ WANDB_NAME=axolotl-amd-llama31-train | ||
$ HUB_MODEL_ID=... | ||
$ dstack apply -f examples/deployment/vllm/amd/.dstack.yml | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
type: task | ||
# The name is optional, if not specified, generated randomly | ||
name: axolotl-train | ||
name: axolotl-nvidia-llama-scout-train | ||
|
||
# Using the official Axolotl's Docker image | ||
image: winglian/axolotl-cloud:main-20240429-py3.11-cu121-2.2.1 | ||
image: axolotlai/axolotl:main-latest | ||
|
||
# Required environment variables | ||
env: | ||
- HF_TOKEN | ||
- WANDB_API_KEY | ||
- WANDB_PROJECT | ||
- WANDB_NAME=axolotl-nvidia-llama-scout-train | ||
- HUB_MODEL_ID | ||
# Commands of the task | ||
commands: | ||
- accelerate launch -m axolotl.cli.train examples/fine-tuning/axolotl/config.yaml | ||
- wget https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/examples/llama-4/scout-qlora-fsdp1.yaml | ||
- axolotl train scout-qlora-fsdp1.yaml --wandb-project $WANDB_PROJECT --wandb-name $WANDB_NAME --hub-model-id $HUB_MODEL_ID | ||
|
||
resources: | ||
gpu: | ||
# 24GB or more vRAM | ||
memory: 24GB.. | ||
# Two or more GPU (required by FSDP) | ||
count: 2.. | ||
# Two GPU (required by FSDP) | ||
gpu: H100:2 | ||
# Shared memory size for inter-process communication | ||
shm_size: 24GB | ||
disk: 500GB.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is
WANDB_API_KEY
not enough?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we need to set WANDB_PROJECT and WANDB_NAME.
The difference is that in our current master it is set in the config file and in this PR, we are sending it as an argument. When we send it as argument, we do not need to include the config.yaml in our repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then at least let's hardcode the value of
WANDB_NAME
, e.g. toaxolotl-amd-llama31-train
. If the user wants, they would change it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW this is another user case when we could set it to
$DSTACK_RUN_NAME