-
Notifications
You must be signed in to change notification settings - Fork 635
Add CI for Autoparallel experiment llama3 on 4 GPUs #2105
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
.github/workflows/integration_test_8gpu_auto_parallel.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Auto Parallel 8 GPU Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'torchtitan/experiments/auto_parallel/**' | ||
| - '.github/workflows/integration_test_8gpu_auto_parallel.yaml' | ||
| pull_request: | ||
| paths: | ||
| - 'torchtitan/experiments/auto_parallel/**' | ||
| - '.github/workflows/integration_test_8gpu_auto_parallel.yaml' | ||
| schedule: | ||
| # Runs every 12 hours | ||
| - cron: '0 */12 * * *' | ||
|
|
||
| concurrency: | ||
| group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash -l -eo pipefail {0} | ||
|
|
||
| jobs: | ||
| build-test: | ||
| uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | ||
| with: | ||
| runner: linux.g5.48xlarge.nvidia.gpu | ||
| gpu-arch-type: cuda | ||
| gpu-arch-version: "12.6" | ||
| # This image is faster to clone than the default, but it lacks CC needed by triton | ||
| # (1m25s vs 2m37s). | ||
| docker-image: torchtitan-ubuntu-20.04-clang12 | ||
| repository: pytorch/torchtitan | ||
| upload-artifact: outputs | ||
| script: | | ||
| set -eux | ||
|
|
||
| # The generic Linux job chooses to use base env, not the one setup by the image | ||
| CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") | ||
| conda activate "${CONDA_ENV}" | ||
|
|
||
| # Log CUDA driver version for debugging. | ||
| DRIVER_VERSION=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n 1 || true) | ||
| echo "CUDA driver version: ${DRIVER_VERSION}" | ||
|
|
||
| pip config --user set global.progress_bar off | ||
|
|
||
| python -m pip install --force-reinstall --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126 | ||
|
|
||
| # Install autoparallel - required dependency for auto_parallel experiment | ||
| python -m pip install git+https://github.com/meta-pytorch/autoparallel.git | ||
|
|
||
| mkdir artifacts-to-be-uploaded | ||
| python -m torchtitan.experiments.auto_parallel.tests.integration_tests artifacts-to-be-uploaded --ngpu 4 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. |
85 changes: 85 additions & 0 deletions
85
torchtitan/experiments/auto_parallel/tests/integration_tests.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| import argparse | ||
| import os | ||
|
|
||
| from tests.integration_tests import OverrideDefinitions | ||
| from tests.integration_tests.run_tests import run_tests | ||
|
|
||
|
|
||
| def build_auto_parallel_test_list() -> list[OverrideDefinitions]: | ||
| """ | ||
| returns a list of OverrideDefinitions that is used to generate | ||
| variations of integration tests based on the same root config file. | ||
| """ | ||
| integration_tests_flavors = [ | ||
| # llama3 tests | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name auto_parallel.llama3", | ||
| "--parallelism.data_parallel_shard_degree 2", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--job.custom_config_module=torchtitan.experiments.auto_parallel.job_config", | ||
| ], | ||
| ], | ||
| "llama3 AutoParallel FSDP+TP", | ||
| "llama3_autoparallel_fsdp_tp", | ||
| ngpu=4, | ||
| ), | ||
| # TODO: Re-enable this once we fix the test | ||
|
Member
Author
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. This doesn't work yet, I'm thinking of enabling it in a different PR |
||
| # deepseek_v3 tests | ||
| # OverrideDefinitions( | ||
| # [ | ||
| # [ | ||
| # "--model.name auto_parallel.deepseek_v3", | ||
| # "--parallelism.data_parallel_shard_degree 2", | ||
| # "--parallelism.expert_parallel_degree 2", | ||
| # "--job.custom_config_module=torchtitan.experiments.auto_parallel.job_config", | ||
| # "--activation_checkpoint.mode none", | ||
| # ], | ||
| # ], | ||
| # "deepseek_v3 AutoParallel FSDP+TP+EP", | ||
| # "deepseekv3_autoparallel_fsdp_tp_ep", | ||
| # ngpu=4, | ||
| # ), | ||
| ] | ||
| return integration_tests_flavors | ||
|
|
||
|
|
||
| _TEST_SUITES_FUNCTION = { | ||
| "auto_parallel": build_auto_parallel_test_list, | ||
| } | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("output_dir") | ||
| parser.add_argument( | ||
| "--config_path", | ||
| default="./tests/integration_tests/base_config.toml", | ||
| help="Base config path for integration tests. This is the config that will be used as a base for all tests.", | ||
| ) | ||
| parser.add_argument( | ||
| "--test_name", | ||
| default="all", | ||
| help="test to run, acceptable values: `test_name` in `build_test_list` (default: all)", | ||
| ) | ||
| parser.add_argument("--ngpu", default=8, type=int) | ||
| args = parser.parse_args() | ||
|
|
||
| if not os.path.exists(args.output_dir): | ||
| os.makedirs(args.output_dir) | ||
| if os.listdir(args.output_dir): | ||
| raise RuntimeError("Please provide an empty output directory.") | ||
|
|
||
| test_list = _TEST_SUITES_FUNCTION["auto_parallel"]() | ||
| run_tests(args, test_list) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
Oops, something went wrong.
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.
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.
The pattern across the other workflows seems to still be naming this 8 GPU
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.
IIUC it basically says we have at most 8 GPU used in each integration tests (and we only have 8 available)