diff --git a/.github/workflows/nightly_build_cpu.yaml b/.github/workflows/nightly_build_cpu.yaml index b543ddc..23718f2 100644 --- a/.github/workflows/nightly_build_cpu.yaml +++ b/.github/workflows/nightly_build_cpu.yaml @@ -63,7 +63,7 @@ jobs: conda install pytorch cpuonly -c pytorch-nightly pip install -r requirements.txt pip install -r dev-requirements.txt - pip install -e ".[dev]" + pip install --no-build-isolation -e ".[dev]" - name: Upload to PyPI shell: bash -l {0} env: diff --git a/.github/workflows/pre_commit.yaml b/.github/workflows/pre_commit.yaml new file mode 100644 index 0000000..c2f7e71 --- /dev/null +++ b/.github/workflows/pre_commit.yaml @@ -0,0 +1,14 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/release_build.yaml b/.github/workflows/release_build.yaml index c404f05..7aa637e 100644 --- a/.github/workflows/release_build.yaml +++ b/.github/workflows/release_build.yaml @@ -55,7 +55,7 @@ jobs: conda install pytorch cpuonly -c pytorch-nightly pip install -r requirements.txt pip install -r dev-requirements.txt - pip install -e ".[dev]" + pip install --no-build-isolation -e ".[dev]" - name: Upload to PyPI shell: bash -l {0} env: diff --git a/.github/workflows/unit_test.yaml b/.github/workflows/unit_test.yaml index 4c97379..03a616d 100644 --- a/.github/workflows/unit_test.yaml +++ b/.github/workflows/unit_test.yaml @@ -28,7 +28,7 @@ jobs: conda install pytorch cpuonly -c pytorch-nightly pip install -r requirements.txt pip install -r dev-requirements.txt - pip install -e ".[dev]" + pip install --no-build-isolation -e ".[dev]" - name: Run unit tests with coverage shell: bash -l {0} run: | diff --git a/.github/workflows/unit_test_gpu.yaml b/.github/workflows/unit_test_gpu.yaml index 0142b94..cd76412 100644 --- a/.github/workflows/unit_test_gpu.yaml +++ b/.github/workflows/unit_test_gpu.yaml @@ -61,7 +61,7 @@ jobs: pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html pip install -r requirements.txt pip install -r dev-requirements.txt - pip install -e ".[dev]" + pip install --no-build-isolation -e ".[dev]" - name: Run unit tests with coverage shell: bash -l {0} run: | diff --git a/.gitignore b/.gitignore index 68bc17f..9969ac1 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,9 @@ target/ profile_default/ ipython_config.py +# MacOS +.DS_Store + # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: diff --git a/benchmarks/deepspeed_opt/main.py b/benchmarks/deepspeed_opt/main.py index e088012..e2d7d8f 100644 --- a/benchmarks/deepspeed_opt/main.py +++ b/benchmarks/deepspeed_opt/main.py @@ -1,3 +1,9 @@ +# 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 logging import os diff --git a/benchmarks/fsdp/main.py b/benchmarks/fsdp/main.py index 2f28968..6538d60 100644 --- a/benchmarks/fsdp/main.py +++ b/benchmarks/fsdp/main.py @@ -1,3 +1,9 @@ +# 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 import time diff --git a/docs/Makefile b/docs/Makefile index b9fa825..d0c3cbf 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -18,4 +18,3 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9f90a09 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.usort] + +first_party_detection = false diff --git a/tests/test_dist_store.py b/tests/test_dist_store.py index 4effe37..0a37da0 100644 --- a/tests/test_dist_store.py +++ b/tests/test_dist_store.py @@ -1,4 +1,10 @@ #!/usr/bin/env python3 +# 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 unittest from datetime import timedelta diff --git a/torchsnapshot/scheduler.py b/torchsnapshot/scheduler.py index 6f20168..9002258 100644 --- a/torchsnapshot/scheduler.py +++ b/torchsnapshot/scheduler.py @@ -1,5 +1,11 @@ #!/usr/bin/env python3 +# 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 asyncio import logging import math diff --git a/torchsnapshot/tricks/deepspeed.py b/torchsnapshot/tricks/deepspeed.py index 076da9e..848d155 100644 --- a/torchsnapshot/tricks/deepspeed.py +++ b/torchsnapshot/tricks/deepspeed.py @@ -1,4 +1,10 @@ #!/usr/bin/env python3 +# 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 logging from types import MethodType from typing import Any, Dict