Skip to content
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

Replace ColossalAIStrategy with external implementation #16757

Merged
merged 22 commits into from
Feb 15, 2023

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Feb 15, 2023

What does this PR do?

The Colossal AI Strategy moves to an external repo where it will be maintained: Lightning-Universe/lightning-ColossalAI#1. A corresponding package will be published to PyPi from which users can install the integration.

  • Replaces the implementation with the one in the lightning-colossalai package.
  • Registeres the strategy="colossal" as a strategy if the package is installed
  • Produces an error message if you request the strategy but don't have the package installed

Before:

trainer = Trainer(strategy="colossalai")

# OR

from lightning.pytorch.strategies import ColossalAIStrategy
trainer = Trainer(strategy=ColossalAIStrategy(...))

Now:

pip install lightning-colossalai
trainer = Trainer(strategy="colossalai")  # only works if  `lightning-colossalai` is installed.

# OR

from lightning_colossalai import ColossalAIStrategy
trainer = Trainer(strategy=ColossalAIStrategy(...))

Follow up:

  • Update docs once the lightning-colossalai package is finalized and public

cc @Borda @justusschock

@awaelchli awaelchli added breaking change Includes a breaking change strategy: colossalai (removed) Colossal-AI labels Feb 15, 2023
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Feb 15, 2023
@awaelchli awaelchli added this to the 2.0 milestone Feb 15, 2023
@awaelchli awaelchli marked this pull request as ready for review February 15, 2023 13:19
@awaelchli awaelchli changed the title Replace ColossalAIStrategy with external implementation WIP: Replace ColossalAIStrategy with external implementation Feb 15, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 15, 2023

⚡ Required checks status: All passing 🟢

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu (macOS-11, lightning, 3.8, 1.11) success
pl-cpu (macOS-11, lightning, 3.9, 1.12) success
pl-cpu (macOS-11, lightning, 3.10, 1.13) success
pl-cpu (macOS-11, lightning, 3.8, 1.11, oldest) success
pl-cpu (ubuntu-20.04, lightning, 3.9, 1.11) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 1.12) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 1.13) success
pl-cpu (ubuntu-20.04, lightning, 3.8, 1.11, oldest) success
pl-cpu (windows-2022, lightning, 3.9, 1.11) success
pl-cpu (windows-2022, lightning, 3.10, 1.12) success
pl-cpu (windows-2022, lightning, 3.10, 1.13) success
pl-cpu (windows-2022, lightning, 3.8, 1.11, oldest) success
pl-cpu (macOS-11, pytorch, 3.8, 1.13) success
pl-cpu (ubuntu-20.04, pytorch, 3.8, 1.13) success
pl-cpu (windows-2022, pytorch, 3.8, 1.13) success

These checks are required after the changes to requirements/pytorch/strategies.txt, src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, tests/tests_pytorch/callbacks/test_gradient_accumulation_scheduler.py, tests/tests_pytorch/helpers/runif.py, tests/tests_pytorch/strategies/test_colossalai.py, tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py.

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) success

These checks are required after the changes to requirements/pytorch/strategies.txt, src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, tests/tests_pytorch/callbacks/test_gradient_accumulation_scheduler.py, tests/tests_pytorch/helpers/runif.py, tests/tests_pytorch/strategies/test_colossalai.py, tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py.

🟢 pytorch_lightning: Benchmarks
Check ID Status
pytorch-lightning.Benchmark success

These checks are required after the changes to requirements/pytorch/strategies.txt.

🟢 pytorch_lightning: Azure HPU
Check ID Status
pytorch-lightning (HPUs) success

These checks are required after the changes to requirements/pytorch/strategies.txt, src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, tests/tests_pytorch/callbacks/test_gradient_accumulation_scheduler.py, tests/tests_pytorch/helpers/runif.py, tests/tests_pytorch/strategies/test_colossalai.py, tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py.

🟢 pytorch_lightning: Azure IPU
Check ID Status
pytorch-lightning (IPUs) success

These checks are required after the changes to requirements/pytorch/strategies.txt, src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, tests/tests_pytorch/callbacks/test_gradient_accumulation_scheduler.py, tests/tests_pytorch/helpers/runif.py, tests/tests_pytorch/strategies/test_colossalai.py, tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py.

🟢 pytorch_lightning: Docs
Check ID Status
make-doctest (pytorch) success
make-html (pytorch) success

These checks are required after the changes to src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, docs/source-pytorch/api_references.rst, docs/source-pytorch/extensions/plugins.rst, requirements/pytorch/strategies.txt.

🟢 pytorch_lightning: Docker
Check ID Status
build-cuda (3.9, 1.11, 11.3.1) success
build-cuda (3.9, 1.12, 11.6.1) success
build-cuda (3.9, 1.13, 11.7.1) success
build-hpu (1.5.0, 1.11.0) success
build-ipu (3.9, 1.13) success
build-NGC success
build-pl (3.9, 1.11, 11.3.1) success
build-pl (3.9, 1.12, 11.6.1) success
build-pl (3.9, 1.13, 11.7.1) success
build-xla (3.8, 1.12) success

These checks are required after the changes to requirements/pytorch/strategies.txt.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to requirements/pytorch/strategies.txt, src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py.

🟢 install
Check ID Status
install-pkg (ubuntu-22.04, app, 3.8) success
install-pkg (ubuntu-22.04, app, 3.10) success
install-pkg (ubuntu-22.04, fabric, 3.8) success
install-pkg (ubuntu-22.04, fabric, 3.10) success
install-pkg (ubuntu-22.04, pytorch, 3.8) success
install-pkg (ubuntu-22.04, pytorch, 3.10) success
install-pkg (ubuntu-22.04, lightning, 3.8) success
install-pkg (ubuntu-22.04, lightning, 3.10) success
install-pkg (ubuntu-22.04, notset, 3.8) success
install-pkg (ubuntu-22.04, notset, 3.10) success
install-pkg (macOS-12, app, 3.8) success
install-pkg (macOS-12, app, 3.10) success
install-pkg (macOS-12, fabric, 3.8) success
install-pkg (macOS-12, fabric, 3.10) success
install-pkg (macOS-12, pytorch, 3.8) success
install-pkg (macOS-12, pytorch, 3.10) success
install-pkg (macOS-12, lightning, 3.8) success
install-pkg (macOS-12, lightning, 3.10) success
install-pkg (macOS-12, notset, 3.8) success
install-pkg (macOS-12, notset, 3.10) success
install-pkg (windows-2022, app, 3.8) success
install-pkg (windows-2022, app, 3.10) success
install-pkg (windows-2022, fabric, 3.8) success
install-pkg (windows-2022, fabric, 3.10) success
install-pkg (windows-2022, pytorch, 3.8) success
install-pkg (windows-2022, pytorch, 3.10) success
install-pkg (windows-2022, lightning, 3.8) success
install-pkg (windows-2022, lightning, 3.10) success
install-pkg (windows-2022, notset, 3.8) success
install-pkg (windows-2022, notset, 3.10) success

These checks are required after the changes to src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py, src/lightning/pytorch/plugins/__init__.py, src/lightning/pytorch/plugins/precision/__init__.py, src/lightning/pytorch/plugins/precision/colossalai.py, src/lightning/pytorch/strategies/__init__.py, src/lightning/pytorch/strategies/colossalai.py, src/lightning/pytorch/trainer/connectors/accelerator_connector.py, src/lightning/pytorch/utilities/imports.py, requirements/pytorch/strategies.txt.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@awaelchli awaelchli changed the title WIP: Replace ColossalAIStrategy with external implementation Replace ColossalAIStrategy with external implementation Feb 15, 2023
Copy link
Member

@justusschock justusschock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Will the external strategies be registered to pypi?

@mergify mergify bot added the ready PRs ready to be merged label Feb 15, 2023
@awaelchli
Copy link
Contributor Author

awaelchli commented Feb 15, 2023

lgtm. Will the external strategies be registered to pypi?

That's the plan yes. Right now there is a chicken and egg problem but once the two PRs land we can complete the integration.

@awaelchli awaelchli enabled auto-merge (squash) February 15, 2023 14:39
@awaelchli awaelchli merged commit 83f4c83 into master Feb 15, 2023
@awaelchli awaelchli deleted the removal/colossal branch February 15, 2023 15:11
@Borda Borda mentioned this pull request Feb 16, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Includes a breaking change pl Generic label for PyTorch Lightning package ready PRs ready to be merged strategy: colossalai (removed) Colossal-AI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants