diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 58f4afe529..8c4d9aa136 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -14,7 +14,6 @@ Brief description of all our automation tools used for boosting development perf | .azure-pipelines/gpu-tests-fabric.yml | Run only GPU-specific tests, standalone\*, and examples. | GPU | | .azure-pipelines/gpu-tests-pytorch.yml | Run only GPU-specific tests, standalone\*, and examples. | GPU | | .azure-pipelines/gpu-benchmarks.yml | Run speed/memory benchmarks for parity with vanila PyTorch. | GPU | -| .github/workflows/ci-flagship-apps.yml | Run end-2-end tests with full applications, including deployment to the production cloud. | CPU | | .github/workflows/ci-tests-pytorch.yml | Run all tests except for accelerator-specific, standalone and slow tests. | CPU | | .github/workflows/tpu-tests.yml | Run only TPU-specific tests. Requires that the PR title contains '\[TPU\]' | TPU | diff --git a/.github/workflows/ci-pkg-extend.yml b/.github/workflows/ci-pkg-extend.yml new file mode 100644 index 0000000000..d9374a0e72 --- /dev/null +++ b/.github/workflows/ci-pkg-extend.yml @@ -0,0 +1,53 @@ +name: Package extras + +# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows +on: + push: + branches: [master, "release/*"] + pull_request: + branches: [master, "release/*"] + types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped + paths: + - ".github/workflows/ci-pkg-extend.yml" + - "requirements/ci.txt" + - "requirements/app/*" + - "requirements/data/*" + - "src/lightning/app/*" + - "src/lightning/data/*" + - "!*.md" + - "!**/*.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +defaults: + run: + shell: bash + +jobs: + + import-pkg: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ["ubuntu-22.04", "macOS-12", "windows-2022"] + pkg-name: ["app", "data"] + python-version: ["3.8", "3.11"] + env: + TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package + run: pip install lightning[${{ matrix.pkg-name }}] -f $TORCH_URL + timeout-minutes: 10 + + - name: Try importing + run: from lightning.${{ matrix.pkg-name }} import * + shell: python + diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 6e82167410..db0f83d524 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -88,7 +88,7 @@ jobs: if: ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'notset' }} working-directory: src/lit run: | - items=("data") + items=("app" "data") for item in "${items[@]}"; do echo "Removing $item" rm -rf $item diff --git a/examples/fabric/tensor_parallel/train.py b/examples/fabric/tensor_parallel/train.py index 4a98f12cf6..1435e5c200 100644 --- a/examples/fabric/tensor_parallel/train.py +++ b/examples/fabric/tensor_parallel/train.py @@ -1,13 +1,14 @@ import lightning as L import torch import torch.nn.functional as F -from data import RandomTokenDataset from lightning.fabric.strategies import ModelParallelStrategy from model import ModelArgs, Transformer from parallelism import parallelize from torch.distributed.tensor.parallel import loss_parallel from torch.utils.data import DataLoader +from data import RandomTokenDataset + def train(): strategy = ModelParallelStrategy( diff --git a/examples/pytorch/tensor_parallel/train.py b/examples/pytorch/tensor_parallel/train.py index 6a91e1242e..37c620f458 100644 --- a/examples/pytorch/tensor_parallel/train.py +++ b/examples/pytorch/tensor_parallel/train.py @@ -1,13 +1,14 @@ import lightning as L import torch import torch.nn.functional as F -from data import RandomTokenDataset from lightning.pytorch.strategies import ModelParallelStrategy from model import ModelArgs, Transformer from parallelism import parallelize from torch.distributed.tensor.parallel import loss_parallel from torch.utils.data import DataLoader +from data import RandomTokenDataset + class Llama3(L.LightningModule): def __init__(self): diff --git a/requirements/app/app.txt b/requirements/app/app.txt new file mode 100644 index 0000000000..9575f5311c --- /dev/null +++ b/requirements/app/app.txt @@ -0,0 +1,3 @@ +# NOTE: this is here only to expose `pip install lightning[app]`. we don't install or test it in this project's CI + +lightning_app >= 2.3.3, <2.3.4 diff --git a/src/lightning/app/__init__.py b/src/lightning/app/__init__.py new file mode 100644 index 0000000000..0d85d9ee33 --- /dev/null +++ b/src/lightning/app/__init__.py @@ -0,0 +1,26 @@ +import sys + +from lightning_utilities.core.imports import RequirementCache, module_available + +__all__ = [] + +if not RequirementCache("lightning_app"): + raise ModuleNotFoundError("Please, run `pip install lightning-app`") # E111 + +else: + import lightning_app + + # Enable resolution at least for lower data namespace + sys.modules["lightning.app"] = lightning_app + + from lightning_app.core.app import LightningApp # noqa: E402 + from lightning_app.core.flow import LightningFlow # noqa: E402 + from lightning_app.core.work import LightningWork # noqa: E402 + from lightning_app.plugin.plugin import LightningPlugin # noqa: E402 + from lightning_app.utilities.packaging.build_config import BuildConfig # noqa: E402 + from lightning_app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 + + if module_available("lightning_app.components.demo"): + from lightning.app.components import demo # noqa: F401 + + __all__ = ["LightningApp", "LightningFlow", "LightningWork", "LightningPlugin", "BuildConfig", "CloudCompute"]