Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/ci-pkg-extend.yml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion .github/workflows/ci-pkg-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/fabric/tensor_parallel/train.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
3 changes: 2 additions & 1 deletion examples/pytorch/tensor_parallel/train.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 3 additions & 0 deletions requirements/app/app.txt
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions src/lightning/app/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]