Skip to content

Commit 40b5140

Browse files
authored
Merge branch 'master' into debug/ddp-fork
2 parents edd48e6 + e55650d commit 40b5140

File tree

36 files changed

+254
-127
lines changed

36 files changed

+254
-127
lines changed

.actions/assistant.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -341,47 +341,6 @@ def create_mirror_package(source_dir: str, package_mapping: dict[str, str]) -> N
341341

342342

343343
class AssistantCLI:
344-
@staticmethod
345-
def requirements_prune_pkgs(packages: Sequence[str], req_files: Sequence[str] = REQUIREMENT_FILES_ALL) -> None:
346-
"""Remove some packages from given requirement files."""
347-
if isinstance(req_files, str):
348-
req_files = [req_files]
349-
for req in req_files:
350-
AssistantCLI._prune_packages(req, packages)
351-
352-
@staticmethod
353-
def _prune_packages(req_file: str, packages: Sequence[str]) -> None:
354-
"""Remove some packages from given requirement files."""
355-
path = Path(req_file)
356-
assert path.exists()
357-
text = path.read_text()
358-
lines = text.splitlines()
359-
final = []
360-
for line in lines:
361-
ln_ = line.strip()
362-
if not ln_ or ln_.startswith("#"):
363-
final.append(line)
364-
continue
365-
req = list(_parse_requirements([ln_]))[0]
366-
if req.name not in packages:
367-
final.append(line)
368-
print(final)
369-
path.write_text("\n".join(final) + "\n")
370-
371-
@staticmethod
372-
def _replace_min(fname: str) -> None:
373-
with open(fname, encoding="utf-8") as fopen:
374-
req = fopen.read().replace(">=", "==")
375-
with open(fname, "w", encoding="utf-8") as fwrite:
376-
fwrite.write(req)
377-
378-
@staticmethod
379-
def replace_oldest_ver(requirement_fnames: Sequence[str] = REQUIREMENT_FILES_ALL) -> None:
380-
"""Replace the min package version by fixed one."""
381-
for fname in requirement_fnames:
382-
print(fname)
383-
AssistantCLI._replace_min(fname)
384-
385344
@staticmethod
386345
def copy_replace_imports(
387346
source_dir: str,

.azure/gpu-tests-fabric.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,16 @@ jobs:
9999
displayName: "Image info & NVIDIA"
100100
101101
- bash: |
102-
python .actions/assistant.py replace_oldest_ver
102+
set -ex
103103
pip install "cython<3.0" wheel # for compatibility
104+
pip install -U "lightning-utilities[cli]"
105+
cd requirements/fabric
106+
# replace range by pin minimal requirements
107+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt']"
108+
# drop deepspeed since it is not supported by our minimal Torch requirements
109+
python -m lightning_utilities.cli requirements prune-pkgs --packages deepspeed --req_files strategies.txt
110+
# uninstall deepspeed since some older docker images have it pre-installed
111+
pip uninstall -y deepspeed
104112
condition: contains(variables['Agent.JobName'], 'oldest')
105113
displayName: "setting oldest dependencies"
106114

.azure/gpu-tests-pytorch.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,16 @@ jobs:
103103
displayName: "Image info & NVIDIA"
104104
105105
- bash: |
106-
python .actions/assistant.py replace_oldest_ver
106+
set -ex
107107
pip install "cython<3.0" wheel # for compatibility
108+
pip install -U "lightning-utilities[cli]"
109+
cd requirements/pytorch
110+
# replace range by pin minimal requirements
111+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt']"
112+
# drop deepspeed since it is not supported by our minimal Torch requirements
113+
python -m lightning_utilities.cli requirements prune-pkgs --packages deepspeed --req_files strategies.txt
114+
# uninstall deepspeed since some older docker images have it pre-installed
115+
pip uninstall -y deepspeed
108116
condition: contains(variables['Agent.JobName'], 'oldest')
109117
displayName: "setting oldest dependencies"
110118

.github/workflows/ci-tests-fabric.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ jobs:
9494
- name: Set min. dependencies
9595
if: ${{ matrix.requires == 'oldest' }}
9696
run: |
97-
python .actions/assistant.py replace_oldest_ver
97+
cd requirements/fabric
98+
pip install -U "lightning-utilities[cli]"
99+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']"
98100
pip install "cython<3.0" wheel
99101
pip install "pyyaml==5.4" --no-build-isolation
100102
@@ -140,7 +142,8 @@ jobs:
140142
run: |
141143
pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
142144
-U --upgrade-strategy=eager --prefer-binary \
143-
--extra-index-url="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}"
145+
--extra-index-url="${TORCH_URL}" \
146+
--find-links="${PYPI_CACHE_DIR}"
144147
pip list
145148
- name: Dump handy wheels
146149
if: github.event_name == 'push' && github.ref == 'refs/heads/master'

.github/workflows/ci-tests-pytorch.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ jobs:
9999
- name: Set min. dependencies
100100
if: ${{ matrix.requires == 'oldest' }}
101101
run: |
102-
python .actions/assistant.py replace_oldest_ver
102+
cd requirements/pytorch
103+
pip install -U "lightning-utilities[cli]"
104+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']"
103105
pip install "cython<3.0" wheel
104106
pip install "pyyaml==5.4" --no-build-isolation
105107
@@ -139,7 +141,9 @@ jobs:
139141
pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
140142
-U --upgrade-strategy=eager --prefer-binary \
141143
-r requirements/_integrations/accelerators.txt \
142-
--extra-index-url="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}" --find-links="https://download.pytorch.org/whl/torch-tensorrt"
144+
--extra-index-url="${TORCH_URL}" \
145+
--find-links="${PYPI_CACHE_DIR}" \
146+
--find-links="https://download.pytorch.org/whl/torch-tensorrt"
143147
pip list
144148
- name: Drop LAI from extensions
145149
if: ${{ matrix.pkg-name != 'lightning' }}

.lightning/workflows/fabric.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ run: |
4343
4444
if [ "${TORCH_VER}" == "2.1" ]; then
4545
echo "Set oldest versions"
46-
python .actions/assistant.py replace_oldest_ver
46+
cd requirements/fabric
47+
pip install -U "lightning-utilities[cli]"
48+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt']"
49+
cd ../..
4750
pip install "cython<3.0" wheel # for compatibility
4851
fi
4952

.lightning/workflows/pytorch.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ run: |
4343
4444
if [ "${TORCH_VER}" == "2.1" ]; then
4545
recho "Set oldest versions"
46-
python .actions/assistant.py replace_oldest_ver
46+
cd requirements/pytorch
47+
pip install -U "lightning-utilities[cli]"
48+
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt']"
49+
cd ../..
4750
pip install "cython<3.0" wheel # for compatibility
4851
fi
4952

dockers/release/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FROM pytorchlightning/pytorch_lightning:base-cuda${CUDA_VERSION}-py${PYTHON_VERS
2121
LABEL maintainer="Lightning-AI <https://github.com/Lightning-AI>"
2222

2323
ARG LIGHTNING_VERSION=""
24+
ARG PYTORCH_VERSION
2425

2526
COPY ./ /home/pytorch-lightning/
2627

@@ -39,7 +40,14 @@ RUN \
3940
fi && \
4041
# otherwise there is collision with folder name and pkg name on Pypi
4142
cd pytorch-lightning && \
42-
pip install setuptools==75.6.0 && \
43+
# pip install setuptools==75.6.0 && \
44+
pip install -U "lightning-utilities[cli]" && \
45+
# drop deepspeed since it is not supported by our minimal Torch requirements \
46+
echo "PYTORCH_VERSION is: '$PYTORCH_VERSION'" && \
47+
if [[ "$PYTORCH_VERSION" =~ ^(2\.1|2\.2|2\.3|2\.4)$ ]]; then \
48+
python -m lightning_utilities.cli requirements prune-pkgs --packages deepspeed --req_files requirements/fabric/strategies.txt ; \
49+
python -m lightning_utilities.cli requirements prune-pkgs --packages deepspeed --req_files requirements/pytorch/strategies.txt ; \
50+
fi && \
4351
PACKAGE_NAME=lightning pip install '.[extra,loggers,strategies]' --no-cache-dir && \
4452
PACKAGE_NAME=pytorch pip install '.[extra,loggers,strategies]' --no-cache-dir && \
4553
cd .. && \

docs/source-fabric/advanced/compile.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ Additional Resources
417417

418418
Here are a few resources for further reading after you complete this tutorial:
419419

420-
- `PyTorch 2.0 Paper <https://pytorch.org/blog/pytorch-2-paper-tutorial/>`_
420+
- `PyTorch 2.0 Paper <https://pytorch.org/get-started/pytorch-2-x/>`_
421421
- `GenAI with PyTorch 2.0 blog post series <https://pytorch.org/blog/accelerating-generative-ai-4/>`_
422422
- `Training Production AI Models with PyTorch 2.0 <https://pytorch.org/blog/training-production-ai-models/>`_
423423
- `Empowering Models with Performance: The Art of Generalized Model Transformation Approach <https://pytorch.org/blog/empowering-models-performance/>`_

docs/source-pytorch/advanced/compile.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ Additional Resources
396396

397397
Here are a few resources for further reading after you complete this tutorial:
398398

399-
- `PyTorch 2.0 Paper <https://pytorch.org/blog/pytorch-2-paper-tutorial/>`_
399+
- `PyTorch 2.0 Paper <https://pytorch.org/get-started/pytorch-2-x/>`_
400400
- `GenAI with PyTorch 2.0 blog post series <https://pytorch.org/blog/accelerating-generative-ai-4/>`_
401401
- `Training Production AI Models with PyTorch 2.0 <https://pytorch.org/blog/training-production-ai-models/>`_
402402
- `Empowering Models with Performance: The Art of Generalized Model Transformation Approach <https://pytorch.org/blog/empowering-models-performance/>`_

0 commit comments

Comments
 (0)