From c9ee63945a305bdac051d8b5cad520470df1ad26 Mon Sep 17 00:00:00 2001 From: Richard Zou Date: Mon, 15 Apr 2024 11:03:39 -0700 Subject: [PATCH 01/76] Custom CUDA extensionsCo-authored-by: Mark Saroufim --- dev-requirements.txt | 1 + setup.py | 58 +++++++++++++ test/test_ops.py | 45 ++++++++++ torchao/__init__.py | 3 + torchao/csrc/cuda/nms.cu | 181 +++++++++++++++++++++++++++++++++++++++ torchao/csrc/init.cpp | 3 + torchao/csrc/nms.cpp | 8 ++ torchao/ops.py | 23 +++++ 8 files changed, 322 insertions(+) create mode 100644 test/test_ops.py create mode 100644 torchao/csrc/cuda/nms.cu create mode 100644 torchao/csrc/init.cpp create mode 100644 torchao/csrc/nms.cpp create mode 100644 torchao/ops.py diff --git a/dev-requirements.txt b/dev-requirements.txt index 3d70d57ab9..6fa7a72dcb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,3 +3,4 @@ expecttest parameterized packaging transformers +ninja diff --git a/setup.py b/setup.py index 378339fa16..2f2cd5a41b 100644 --- a/setup.py +++ b/setup.py @@ -4,10 +4,20 @@ # LICENSE file in the root directory of this source tree. import os +import torch +import glob from datetime import datetime from setuptools import find_packages, setup +from torch.utils.cpp_extension import ( + CppExtension, + CUDAExtension, + BuildExtension, + CUDA_HOME, +) + + current_date = datetime.now().strftime("%Y.%m.%d") @@ -23,6 +33,52 @@ def read_requirements(file_path): version = current_date if package_name == "torchao-nightly" else "0.1" +def get_extensions(): + debug_mode = os.getenv('DEBUG', '0') == '1' + if debug_mode: + print("Compiling in debug mode") + + use_cuda = torch.cuda.is_available() and CUDA_HOME is not None + extension = CUDAExtension if use_cuda else CppExtension + + extra_link_args = [] + extra_compile_args = { + "cxx": [ + "-O3" if not debug_mode else "-O0", + "-fdiagnostics-color=always", + ], + "nvcc": [ + "-O3" if not debug_mode else "-O0", + ] + } + if debug_mode: + extra_compile_args["cxx"].append("-g") + extra_compile_args["nvcc"].append("-g") + extra_link_args.extend(["-O0", "-g"]) + + # this_dir = os.path.dirname(os.path.abspath(__file__)) + this_dir = os.path.dirname(os.path.curdir) + extensions_dir = os.path.join(this_dir, "torchao", "csrc") + sources = list(glob.glob(os.path.join(extensions_dir, "*.cpp"))) + + extensions_cuda_dir = os.path.join(extensions_dir, "cuda") + cuda_sources = list(glob.glob(os.path.join(extensions_cuda_dir, "*.cu"))) + + if use_cuda: + sources += cuda_sources + + ext_modules = [ + extension( + "torchao._C", + sources, + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + ) + ] + + return ext_modules + + setup( name=package_name, version=version, @@ -31,9 +87,11 @@ def read_requirements(file_path): package_data={ "torchao.kernel.configs": ["*.pkl"], }, + ext_modules=get_extensions(), install_requires=read_requirements("requirements.txt"), description="Package for applying ao techniques to GPU models", long_description=open("README.md").read(), long_description_content_type="text/markdown", url="https://github.com/pytorch-labs/ao", + cmdclass={"build_ext": BuildExtension}, ) diff --git a/test/test_ops.py b/test/test_ops.py new file mode 100644 index 0000000000..3378b69eae --- /dev/null +++ b/test/test_ops.py @@ -0,0 +1,45 @@ +import torch +from torch.testing._internal.common_utils import TestCase +from torch.testing._internal.optests import opcheck +import torchao +from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 +import unittest + + +# torch.testing._internal.optests.generate_tests.OpCheckError: opcheck(op, ...): +# test_faketensor failed with module 'torch' has no attribute '_custom_ops' (scroll up for stack trace) +class TestOps(TestCase): + def _create_tensors_with_iou(self, N, iou_thresh): + # force last box to have a pre-defined iou with the first box + # let b0 be [x0, y0, x1, y1], and b1 be [x0, y0, x1 + d, y1], + # then, in order to satisfy ops.iou(b0, b1) == iou_thresh, + # we need to have d = (x1 - x0) * (1 - iou_thresh) / iou_thresh + # Adjust the threshold upward a bit with the intent of creating + # at least one box that exceeds (barely) the threshold and so + # should be suppressed. + boxes = torch.rand(N, 4) * 100 + boxes[:, 2:] += boxes[:, :2] + boxes[-1, :] = boxes[0, :] + x0, y0, x1, y1 = boxes[-1].tolist() + iou_thresh += 1e-5 + boxes[-1, 2] += (x1 - x0) * (1 - iou_thresh) / iou_thresh + scores = torch.rand(N) + return boxes, scores + + @unittest.skipIf(not TORCH_VERSION_AFTER_2_4, "skipping when torch verion is 2.3 or lower") + def test_nms(self): + iou = 0.2 + boxes, scores = self._create_tensors_with_iou(1000, iou) + boxes = boxes.cuda() + scores = scores.cuda() + + # smoke test + _ = torchao.ops.nms(boxes, scores, iou) + + # comprehensive testing + test_utils = ["test_schema", "test_autograd_registration", "test_faketensor", "test_aot_dispatch_dynamic"] + opcheck(torch.ops.torchao.nms, (boxes, scores, iou), test_utils=test_utils) + + +if __name__ == "__main__": + unittest.main() diff --git a/torchao/__init__.py b/torchao/__init__.py index ecd2ccf4b9..d9b73e3583 100644 --- a/torchao/__init__.py +++ b/torchao/__init__.py @@ -4,6 +4,9 @@ autoquant, ) from . import dtypes +import torch +from . import _C +from . import ops __all__ = [ "dtypes", diff --git a/torchao/csrc/cuda/nms.cu b/torchao/csrc/cuda/nms.cu new file mode 100644 index 0000000000..5bbbff8d79 --- /dev/null +++ b/torchao/csrc/cuda/nms.cu @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include + +namespace torchao { + +namespace { + +#define CUDA_1D_KERNEL_LOOP_T(i, n, index_t) \ + for (index_t i = (blockIdx.x * blockDim.x) + threadIdx.x; i < (n); \ + i += (blockDim.x * gridDim.x)) + +#define CUDA_1D_KERNEL_LOOP(i, n) CUDA_1D_KERNEL_LOOP_T(i, n, int) + +template +constexpr __host__ __device__ inline integer ceil_div(integer n, integer m) { + return (n + m - 1) / m; +} + +int const threadsPerBlock = sizeof(unsigned long long) * 8; + +template +__device__ inline bool devIoU( + T const* const a, + T const* const b, + const float threshold) { + T left = max(a[0], b[0]), right = min(a[2], b[2]); + T top = max(a[1], b[1]), bottom = min(a[3], b[3]); + T width = max(right - left, (T)0), height = max(bottom - top, (T)0); + using acc_T = at::acc_type; + acc_T interS = (acc_T)width * height; + acc_T Sa = ((acc_T)a[2] - a[0]) * (a[3] - a[1]); + acc_T Sb = ((acc_T)b[2] - b[0]) * (b[3] - b[1]); + return (interS / (Sa + Sb - interS)) > threshold; +} + +template +__global__ void nms_kernel_impl( + int n_boxes, + double iou_threshold, + const T* dev_boxes, + unsigned long long* dev_mask) { + const int row_start = blockIdx.y; + const int col_start = blockIdx.x; + + if (row_start > col_start) + return; + + const int row_size = + min(n_boxes - row_start * threadsPerBlock, threadsPerBlock); + const int col_size = + min(n_boxes - col_start * threadsPerBlock, threadsPerBlock); + + __shared__ T block_boxes[threadsPerBlock * 4]; + if (threadIdx.x < col_size) { + block_boxes[threadIdx.x * 4 + 0] = + dev_boxes[(threadsPerBlock * col_start + threadIdx.x) * 4 + 0]; + block_boxes[threadIdx.x * 4 + 1] = + dev_boxes[(threadsPerBlock * col_start + threadIdx.x) * 4 + 1]; + block_boxes[threadIdx.x * 4 + 2] = + dev_boxes[(threadsPerBlock * col_start + threadIdx.x) * 4 + 2]; + block_boxes[threadIdx.x * 4 + 3] = + dev_boxes[(threadsPerBlock * col_start + threadIdx.x) * 4 + 3]; + } + __syncthreads(); + + if (threadIdx.x < row_size) { + const int cur_box_idx = threadsPerBlock * row_start + threadIdx.x; + const T* cur_box = dev_boxes + cur_box_idx * 4; + int i = 0; + unsigned long long t = 0; + int start = 0; + if (row_start == col_start) { + start = threadIdx.x + 1; + } + for (i = start; i < col_size; i++) { + if (devIoU(cur_box, block_boxes + i * 4, iou_threshold)) { + t |= 1ULL << i; + } + } + const int col_blocks = ceil_div(n_boxes, threadsPerBlock); + dev_mask[cur_box_idx * col_blocks + col_start] = t; + } +} + +at::Tensor nms_kernel( + const at::Tensor& dets, + const at::Tensor& scores, + double iou_threshold) { + TORCH_CHECK(dets.is_cuda(), "dets must be a CUDA tensor"); + TORCH_CHECK(scores.is_cuda(), "scores must be a CUDA tensor"); + + TORCH_CHECK( + dets.dim() == 2, "boxes should be a 2d tensor, got ", dets.dim(), "D"); + TORCH_CHECK( + dets.size(1) == 4, + "boxes should have 4 elements in dimension 1, got ", + dets.size(1)); + TORCH_CHECK( + scores.dim() == 1, + "scores should be a 1d tensor, got ", + scores.dim(), + "D"); + TORCH_CHECK( + dets.size(0) == scores.size(0), + "boxes and scores should have same number of elements in ", + "dimension 0, got ", + dets.size(0), + " and ", + scores.size(0)) + + at::cuda::CUDAGuard device_guard(dets.device()); + + if (dets.numel() == 0) { + return at::empty({0}, dets.options().dtype(at::kLong)); + } + + auto order_t = std::get<1>( + scores.sort(/*stable=*/true, /*dim=*/0, /* descending=*/true)); + auto dets_sorted = dets.index_select(0, order_t).contiguous(); + + int dets_num = dets.size(0); + + const int col_blocks = ceil_div(dets_num, threadsPerBlock); + + at::Tensor mask = + at::empty({dets_num * col_blocks}, dets.options().dtype(at::kLong)); + + dim3 blocks(col_blocks, col_blocks); + dim3 threads(threadsPerBlock); + cudaStream_t stream = at::cuda::getCurrentCUDAStream(); + + AT_DISPATCH_FLOATING_TYPES_AND_HALF( + dets_sorted.scalar_type(), "nms_kernel", [&] { + nms_kernel_impl<<>>( + dets_num, + iou_threshold, + dets_sorted.data_ptr(), + (unsigned long long*)mask.data_ptr()); + }); + + at::Tensor mask_cpu = mask.to(at::kCPU); + unsigned long long* mask_host = + (unsigned long long*)mask_cpu.data_ptr(); + + std::vector remv(col_blocks); + memset(&remv[0], 0, sizeof(unsigned long long) * col_blocks); + + at::Tensor keep = + at::empty({dets_num}, dets.options().dtype(at::kLong).device(at::kCPU)); + int64_t* keep_out = keep.data_ptr(); + + int num_to_keep = 0; + for (int i = 0; i < dets_num; i++) { + int nblock = i / threadsPerBlock; + int inblock = i % threadsPerBlock; + + if (!(remv[nblock] & (1ULL << inblock))) { + keep_out[num_to_keep++] = i; + unsigned long long* p = mask_host + i * col_blocks; + for (int j = nblock; j < col_blocks; j++) { + remv[j] |= p[j]; + } + } + } + + AT_CUDA_CHECK(cudaGetLastError()); + return order_t.index( + {keep.narrow(/*dim=*/0, /*start=*/0, /*length=*/num_to_keep) + .to(order_t.device(), keep.scalar_type())}); +} + +} // namespace + +TORCH_LIBRARY_IMPL(torchao, CUDA, m) { + m.impl("torchao::nms", &nms_kernel); +} + +} // namespace torchao diff --git a/torchao/csrc/init.cpp b/torchao/csrc/init.cpp new file mode 100644 index 0000000000..cb2ec42a45 --- /dev/null +++ b/torchao/csrc/init.cpp @@ -0,0 +1,3 @@ +#include + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {} diff --git a/torchao/csrc/nms.cpp b/torchao/csrc/nms.cpp new file mode 100644 index 0000000000..5cc26d1593 --- /dev/null +++ b/torchao/csrc/nms.cpp @@ -0,0 +1,8 @@ +#include +#include +#include + +TORCH_LIBRARY_FRAGMENT(torchao, m) { + m.impl_abstract_pystub("torchao.ops"); + m.def("nms(Tensor dets, Tensor scores, float iou_threshold) -> Tensor"); +} diff --git a/torchao/ops.py b/torchao/ops.py new file mode 100644 index 0000000000..0931d32026 --- /dev/null +++ b/torchao/ops.py @@ -0,0 +1,23 @@ +import torch +from torch import Tensor + +def nms(boxes: Tensor, scores: Tensor, iou_threshold: float) -> Tensor: + """ + See https://pytorch.org/vision/main/generated/torchvision.ops.nms.html + """ + return torch.ops.torchao.nms.default(boxes, scores, iou_threshold) + + +# Defines the meta kernel / fake kernel / abstract impl +@torch.library.impl_abstract("torchao::nms") +def _(dets, scores, iou_threshold): + torch._check(dets.dim() == 2, lambda: f"boxes should be a 2d tensor, got {dets.dim()}D") + torch._check(dets.size(1) == 4, lambda: f"boxes should have 4 elements in dimension 1, got {dets.size(1)}") + torch._check(scores.dim() == 1, lambda: f"scores should be a 1d tensor, got {scores.dim()}") + torch._check( + dets.size(0) == scores.size(0), + lambda: f"boxes and scores should have same number of elements in dimension 0, got {dets.size(0)} and {scores.size(0)}", + ) + ctx = torch._custom_ops.get_ctx() + num_to_keep = ctx.create_unbacked_symint() + return dets.new_empty(num_to_keep, dtype=torch.long) From e93fd38939c8ca1bb8a9384e7aacc428072de42c Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 11:17:26 -0700 Subject: [PATCH 02/76] ci fix --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2f2cd5a41b..461b0d575c 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from datetime import datetime from setuptools import find_packages, setup - +import torch from torch.utils.cpp_extension import ( CppExtension, CUDAExtension, From 1eaa35f90ac46550344a30aee3633abd8e31f007 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 11:37:30 -0700 Subject: [PATCH 03/76] add continue on ci fail --- .github/workflows/regression_test.yml | 2 ++ setup.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 0a53eb911e..f0b134b4cb 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -32,6 +32,8 @@ jobs: runs-on: 32-core-ubuntu torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} + continue-on-error: true + steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 461b0d575c..72345d9970 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,6 @@ from datetime import datetime from setuptools import find_packages, setup -import torch from torch.utils.cpp_extension import ( CppExtension, CUDAExtension, From 24992d00e854e4346739f76d1c3ab51bd8ab8f12 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 11:45:10 -0700 Subject: [PATCH 04/76] add verbose pip logging --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index f0b134b4cb..87cc62b7cd 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -51,7 +51,7 @@ jobs: - name: Install package run: | - pip install . + pip install . -vvv - name: Run tests run: | From bd8eed114d8fd82f25d2f89101734ab9b705ea59 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 11:45:51 -0700 Subject: [PATCH 05/76] update --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 87cc62b7cd..648ad41dd5 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -32,7 +32,7 @@ jobs: runs-on: 32-core-ubuntu torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} - continue-on-error: true + # continue-on-error: true steps: - uses: actions/checkout@v2 From 5d9ff0a2121c5755146eae6d4bc48b3ddce9cc0f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 12:08:05 -0700 Subject: [PATCH 06/76] remove pip upgrade --- .github/workflows/regression_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 648ad41dd5..1aac9b6b11 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -44,7 +44,6 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt From ede55b8875340face88546870b22a4ca6b071d85 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 12:13:12 -0700 Subject: [PATCH 07/76] remove torch from requirements --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1420797da0..9a88bb189a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -torch numpy sentencepiece packaging From 97857eb7049b9cd483eecc1ad9b58b6d2d27f1cf Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 12:15:22 -0700 Subject: [PATCH 08/76] add python -m --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1aac9b6b11..610cf97f80 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -50,7 +50,7 @@ jobs: - name: Install package run: | - pip install . -vvv + python -m pip install . -vvv - name: Run tests run: | From 931c97f360d1f115677d9b6be8762fddd6285111 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 12:15:59 -0700 Subject: [PATCH 09/76] readd upgrade --- .github/workflows/regression_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 610cf97f80..a7675b3ed8 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -44,6 +44,7 @@ jobs: - name: Install dependencies run: | + python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt From c11b8c2bf18a467c52245d210233e6c18c817a77 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:29:07 -0700 Subject: [PATCH 10/76] make everything python pip install --- .github/workflows/regression_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index a7675b3ed8..2e799a7396 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -45,9 +45,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ${{ matrix.torch-spec }} - pip install -r requirements.txt - pip install -r dev-requirements.txt + python pip install ${{ matrix.torch-spec }} + python pip install -r requirements.txt + python pip install -r dev-requirements.txt - name: Install package run: | From b46297c514d96f6de387eb070fe6a9598af874ee Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:31:08 -0700 Subject: [PATCH 11/76] typo --- .github/workflows/regression_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 2e799a7396..e6fda79911 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -45,9 +45,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python pip install ${{ matrix.torch-spec }} - python pip install -r requirements.txt - python pip install -r dev-requirements.txt + python -m pip install ${{ matrix.torch-spec }} + python -m pip install -r requirements.txt + python -m pip install -r dev-requirements.txt - name: Install package run: | From 2531971d094f70266167a30a6b18fa6d20cb8210 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:39:00 -0700 Subject: [PATCH 12/76] bla --- .github/workflows/regression_test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index e6fda79911..84fd1bb4fc 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -44,14 +44,16 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install ${{ matrix.torch-spec }} - python -m pip install -r requirements.txt - python -m pip install -r dev-requirements.txt + python -m venv env + source env/bin/activate + pip install --upgrade pip + pip install ${{ matrix.torch-spec }} + pip install -r requirements.txt + pip install -r dev-requirements.txt - name: Install package run: | - python -m pip install . -vvv + pip install . -vvv - name: Run tests run: | From cfb5abffec28e3cbb0db5d37657fc1be2280746e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:41:11 -0700 Subject: [PATCH 13/76] add torch again to dependencies --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 9a88bb189a..1420797da0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +torch numpy sentencepiece packaging From 7f9a7a1a28d3d6da6508c361ce075b1d566a145d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:44:34 -0700 Subject: [PATCH 14/76] upd --- .github/workflows/regression_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 84fd1bb4fc..e1837c1950 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -44,16 +44,16 @@ jobs: - name: Install dependencies run: | - python -m venv env - source env/bin/activate - pip install --upgrade pip + # python -m venv env + # source env/bin/activate + # pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt - name: Install package run: | - pip install . -vvv + pip install --no-build-isolation . - name: Run tests run: | From 4d67630b212574e17c5c943e57e05d9031f06924 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 13:48:43 -0700 Subject: [PATCH 15/76] udpate --- .github/workflows/regression_test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index e1837c1950..cf4860453d 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -44,16 +44,17 @@ jobs: - name: Install dependencies run: | - # python -m venv env - # source env/bin/activate - # pip install --upgrade pip - pip install ${{ matrix.torch-spec }} - pip install -r requirements.txt - pip install -r dev-requirements.txt + python -m venv env + source env/bin/activate + python -m pip install --upgrade pip + python -m pip install ${{ matrix.torch-spec }} + python -m pip install -r requirements.txt + python -m pip install -r dev-requirements.txt - name: Install package run: | - pip install --no-build-isolation . + source env/bin/activate + python -m pip install . - name: Run tests run: | From 39513690d56c30aa046b7a66eac415eb5157dc27 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:04:02 -0700 Subject: [PATCH 16/76] one more --- .github/workflows/regression_test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index cf4860453d..2ebc7236cf 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -42,7 +42,7 @@ jobs: with: python-version: '3.9' - - name: Install dependencies + - name: Install package run: | python -m venv env source env/bin/activate @@ -50,10 +50,6 @@ jobs: python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt python -m pip install -r dev-requirements.txt - - - name: Install package - run: | - source env/bin/activate python -m pip install . - name: Run tests From 2b274f3fcd55197de6e20db29a673ba9c3e92602 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:14:29 -0700 Subject: [PATCH 17/76] bla --- .github/workflows/regression_test.yml | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 2ebc7236cf..cf4860453d 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -42,7 +42,7 @@ jobs: with: python-version: '3.9' - - name: Install package + - name: Install dependencies run: | python -m venv env source env/bin/activate @@ -50,6 +50,10 @@ jobs: python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt python -m pip install -r dev-requirements.txt + + - name: Install package + run: | + source env/bin/activate python -m pip install . - name: Run tests diff --git a/setup.py b/setup.py index 72345d9970..87ae0b1e45 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ # LICENSE file in the root directory of this source tree. import os -import torch +# import torch import glob from datetime import datetime From ed55d4df08bb708bf1c490737c911f3dfeaf2cf3 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:19:38 -0700 Subject: [PATCH 18/76] uipda --- setup.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 87ae0b1e45..b79f2918ad 100644 --- a/setup.py +++ b/setup.py @@ -4,17 +4,11 @@ # LICENSE file in the root directory of this source tree. import os -# import torch import glob from datetime import datetime from setuptools import find_packages, setup -from torch.utils.cpp_extension import ( - CppExtension, - CUDAExtension, - BuildExtension, - CUDA_HOME, -) + current_date = datetime.now().strftime("%Y.%m.%d") @@ -31,8 +25,20 @@ def read_requirements(file_path): # Version is year.month.date if using nightlies version = current_date if package_name == "torchao-nightly" else "0.1" +def getBuildExtension(): + import torch + from torch.utils.cpp_extension import BuildExtension + return BuildExtension def get_extensions(): + import torch + + from torch.utils.cpp_extension import ( + CppExtension, + CUDAExtension, + BuildExtension, + CUDA_HOME, + ) debug_mode = os.getenv('DEBUG', '0') == '1' if debug_mode: print("Compiling in debug mode") @@ -92,5 +98,5 @@ def get_extensions(): long_description=open("README.md").read(), long_description_content_type="text/markdown", url="https://github.com/pytorch-labs/ao", - cmdclass={"build_ext": BuildExtension}, + cmdclass={"build_ext": getBuildExtension()}, ) From faebb78aa41f145a1703aa157cf05ccd50d9adaa Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:21:41 -0700 Subject: [PATCH 19/76] bla --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index cf4860453d..410bb9645c 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -54,7 +54,7 @@ jobs: - name: Install package run: | source env/bin/activate - python -m pip install . + python setup.py install - name: Run tests run: | From 6a4062797609e4b4a4c0a640074511f8b4ad2246 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:24:11 -0700 Subject: [PATCH 20/76] bla --- setup.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index b79f2918ad..ffd05dbbd2 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,14 @@ from datetime import datetime from setuptools import find_packages, setup +import torch +from torch.utils.cpp_extension import ( +CppExtension, +CUDAExtension, +BuildExtension, +CUDA_HOME, +) current_date = datetime.now().strftime("%Y.%m.%d") @@ -25,20 +32,8 @@ def read_requirements(file_path): # Version is year.month.date if using nightlies version = current_date if package_name == "torchao-nightly" else "0.1" -def getBuildExtension(): - import torch - from torch.utils.cpp_extension import BuildExtension - return BuildExtension - def get_extensions(): - import torch - - from torch.utils.cpp_extension import ( - CppExtension, - CUDAExtension, - BuildExtension, - CUDA_HOME, - ) + debug_mode = os.getenv('DEBUG', '0') == '1' if debug_mode: print("Compiling in debug mode") @@ -98,5 +93,5 @@ def get_extensions(): long_description=open("README.md").read(), long_description_content_type="text/markdown", url="https://github.com/pytorch-labs/ao", - cmdclass={"build_ext": getBuildExtension()}, + cmdclass={"build_ext": BuildExtension}, ) From 18ac42c00e9d37ca5c7adb5037d7483b27055bf0 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:25:26 -0700 Subject: [PATCH 21/76] add venv for pytest --- .github/workflows/regression_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 410bb9645c..6e642bf025 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -58,4 +58,5 @@ jobs: - name: Run tests run: | + source env/bin/activate pytest test --verbose -s From ccac2804d439449d52030e886d67173fc4dc912e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 14:37:50 -0700 Subject: [PATCH 22/76] skip test if no cuda --- test/test_ops.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_ops.py b/test/test_ops.py index 3378b69eae..6e84d138ad 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -26,6 +26,7 @@ def _create_tensors_with_iou(self, N, iou_thresh): scores = torch.rand(N) return boxes, scores + @unittest.skipIf(not torch.cuda.is_available(), "CUDA not available") @unittest.skipIf(not TORCH_VERSION_AFTER_2_4, "skipping when torch verion is 2.3 or lower") def test_nms(self): iou = 0.2 From b229d99e669553bac5f35b3708836e2ae09ce31f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 15:04:53 -0700 Subject: [PATCH 23/76] push --- test/test_ops.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_ops.py b/test/test_ops.py index 6e84d138ad..e5a75ceed8 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -5,6 +5,8 @@ from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 import unittest +def is_nightly_with_dev(version): + return "dev" in version # torch.testing._internal.optests.generate_tests.OpCheckError: opcheck(op, ...): # test_faketensor failed with module 'torch' has no attribute '_custom_ops' (scroll up for stack trace) @@ -26,6 +28,7 @@ def _create_tensors_with_iou(self, N, iou_thresh): scores = torch.rand(N) return boxes, scores + @unittest.skipIf(is_nightly_with_dev(torch.__version__), " NotImplementedError: Could not run 'torchao::nms' with arguments from the 'CUDA' backend") @unittest.skipIf(not torch.cuda.is_available(), "CUDA not available") @unittest.skipIf(not TORCH_VERSION_AFTER_2_4, "skipping when torch verion is 2.3 or lower") def test_nms(self): From 9b44bc7ac850bef7dcd823f63f16582c048c08fa Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 15:09:30 -0700 Subject: [PATCH 24/76] fix test --- test/test_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_ops.py b/test/test_ops.py index e5a75ceed8..df4eb2e3c2 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -5,8 +5,8 @@ from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 import unittest -def is_nightly_with_dev(version): - return "dev" in version +def is_nightly_with_dev_cud(version): + return "dev" in version and "cu" in version # torch.testing._internal.optests.generate_tests.OpCheckError: opcheck(op, ...): # test_faketensor failed with module 'torch' has no attribute '_custom_ops' (scroll up for stack trace) From fd34023a585c11a3bbf427231d2972d8d709aa61 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 15:12:39 -0700 Subject: [PATCH 25/76] fix test --- test/test_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_ops.py b/test/test_ops.py index df4eb2e3c2..a51d900ed6 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -5,7 +5,7 @@ from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 import unittest -def is_nightly_with_dev_cud(version): +def is_nightly_with_dev_cuda(version): return "dev" in version and "cu" in version # torch.testing._internal.optests.generate_tests.OpCheckError: opcheck(op, ...): @@ -28,7 +28,7 @@ def _create_tensors_with_iou(self, N, iou_thresh): scores = torch.rand(N) return boxes, scores - @unittest.skipIf(is_nightly_with_dev(torch.__version__), " NotImplementedError: Could not run 'torchao::nms' with arguments from the 'CUDA' backend") + @unittest.skipIf(is_nightly_with_dev_cuda(torch.__version__), " NotImplementedError: Could not run 'torchao::nms' with arguments from the 'CUDA' backend") @unittest.skipIf(not torch.cuda.is_available(), "CUDA not available") @unittest.skipIf(not TORCH_VERSION_AFTER_2_4, "skipping when torch verion is 2.3 or lower") def test_nms(self): From e3cf0a88c95aa5fbc42b3daf62e8263b7b459b7e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 16:20:57 -0700 Subject: [PATCH 26/76] fix skip tests --- test/test_ops.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/test_ops.py b/test/test_ops.py index a51d900ed6..6e84d138ad 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -5,8 +5,6 @@ from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 import unittest -def is_nightly_with_dev_cuda(version): - return "dev" in version and "cu" in version # torch.testing._internal.optests.generate_tests.OpCheckError: opcheck(op, ...): # test_faketensor failed with module 'torch' has no attribute '_custom_ops' (scroll up for stack trace) @@ -28,7 +26,6 @@ def _create_tensors_with_iou(self, N, iou_thresh): scores = torch.rand(N) return boxes, scores - @unittest.skipIf(is_nightly_with_dev_cuda(torch.__version__), " NotImplementedError: Could not run 'torchao::nms' with arguments from the 'CUDA' backend") @unittest.skipIf(not torch.cuda.is_available(), "CUDA not available") @unittest.skipIf(not TORCH_VERSION_AFTER_2_4, "skipping when torch verion is 2.3 or lower") def test_nms(self): From bb113e24752b3797009b36beddf109e408b4672e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 16:46:06 -0700 Subject: [PATCH 27/76] reuse pip install . --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 6e642bf025..c051ee9f2b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -54,7 +54,7 @@ jobs: - name: Install package run: | source env/bin/activate - python setup.py install + python -m pip install . - name: Run tests run: | From 342715658c270a4d5ecfd6d5847692c00cf67c0c Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 16:51:30 -0700 Subject: [PATCH 28/76] add more debugging tools --- .github/workflows/regression_test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index c051ee9f2b..b82e0cc601 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -51,6 +51,12 @@ jobs: python -m pip install -r requirements.txt python -m pip install -r dev-requirements.txt + - name: List dependencies + run: | + source env/bin/activate + pip list + which python + - name: Install package run: | source env/bin/activate From 2c6a6675f681fb4d0f1031c671690d2961176e4b Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:05:40 -0700 Subject: [PATCH 29/76] yolo --- .github/workflows/regression_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index b82e0cc601..2d544f28c8 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -45,7 +45,7 @@ jobs: - name: Install dependencies run: | python -m venv env - source env/bin/activate + source /home/runner/work/ao/ao/env/bin/activate python -m pip install --upgrade pip python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt @@ -53,16 +53,16 @@ jobs: - name: List dependencies run: | - source env/bin/activate + source /home/runner/work/ao/ao/env/bin/activate pip list which python - name: Install package run: | - source env/bin/activate + source /home/runner/work/ao/ao/env/bin/activate python -m pip install . - name: Run tests run: | - source env/bin/activate + source /home/runner/work/ao/ao/env/bin/activate pytest test --verbose -s From 03aba8f0eca402e5fc9385ea6baf2cb742dc16c3 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:07:18 -0700 Subject: [PATCH 30/76] revert yolo change --- .github/workflows/regression_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 2d544f28c8..b82e0cc601 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -45,7 +45,7 @@ jobs: - name: Install dependencies run: | python -m venv env - source /home/runner/work/ao/ao/env/bin/activate + source env/bin/activate python -m pip install --upgrade pip python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt @@ -53,16 +53,16 @@ jobs: - name: List dependencies run: | - source /home/runner/work/ao/ao/env/bin/activate + source env/bin/activate pip list which python - name: Install package run: | - source /home/runner/work/ao/ao/env/bin/activate + source env/bin/activate python -m pip install . - name: Run tests run: | - source /home/runner/work/ao/ao/env/bin/activate + source env/bin/activate pytest test --verbose -s From 074ef41ee208a2d39ed4dbe15ae4e9b715559133 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:09:31 -0700 Subject: [PATCH 31/76] fix --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index b82e0cc601..98fabe56b3 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -54,7 +54,7 @@ jobs: - name: List dependencies run: | source env/bin/activate - pip list + python -m pip list which python - name: Install package From 04db944296e284fe4574905d83b21fb5df1cb730 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:17:38 -0700 Subject: [PATCH 32/76] remove custom install --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 98fabe56b3..0c647e0514 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -47,7 +47,7 @@ jobs: python -m venv env source env/bin/activate python -m pip install --upgrade pip - python -m pip install ${{ matrix.torch-spec }} + # python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt python -m pip install -r dev-requirements.txt From bca7b5c811cb7cf0a83382c2dfc578fc23003503 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:22:11 -0700 Subject: [PATCH 33/76] print torch version --- .github/workflows/regression_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 0c647e0514..20fd229338 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -57,8 +57,10 @@ jobs: python -m pip list which python + - name: Install package run: | + python -c "import torch; print(torch.__version__)" source env/bin/activate python -m pip install . From 327cd2b08f5afe98287fc6b906f95d60ba6c9054 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:25:11 -0700 Subject: [PATCH 34/76] print torch version --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 20fd229338..a3e7a9b1ff 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -60,8 +60,8 @@ jobs: - name: Install package run: | - python -c "import torch; print(torch.__version__)" source env/bin/activate + python -c "import torch; print(torch.__version__)" python -m pip install . - name: Run tests From d860891cdcfe91eddf0d99a3e88c63de2e75004d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:37:02 -0700 Subject: [PATCH 35/76] teest' --- .github/workflows/regression_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index a3e7a9b1ff..818dfb7132 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -47,9 +47,9 @@ jobs: python -m venv env source env/bin/activate python -m pip install --upgrade pip - # python -m pip install ${{ matrix.torch-spec }} - python -m pip install -r requirements.txt - python -m pip install -r dev-requirements.txt + python -m pip install ${{ matrix.torch-spec }} + # python -m pip install -r requirements.txt + # python -m pip install -r dev-requirements.txt - name: List dependencies run: | From 250dba1fe62a547fa6648f3086ca56c37634b712 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:40:11 -0700 Subject: [PATCH 36/76] try pip3? --- .github/workflows/regression_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 818dfb7132..1e443d9fcf 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -46,15 +46,15 @@ jobs: run: | python -m venv env source env/bin/activate - python -m pip install --upgrade pip - python -m pip install ${{ matrix.torch-spec }} - # python -m pip install -r requirements.txt - # python -m pip install -r dev-requirements.txt + python -m pip3 install --upgrade pip + python -m pip3 install ${{ matrix.torch-spec }} + python -m pip3 install -r requirements.txt + python -m pip3 install -r dev-requirements.txt - name: List dependencies run: | source env/bin/activate - python -m pip list + python -m pip3 list which python @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python -m pip install . + python -m pip3 install . - name: Run tests run: | From 15c5e4168e8f58810781166b3f6d15824ece278b Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:41:09 -0700 Subject: [PATCH 37/76] remove pip3 --- .github/workflows/regression_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1e443d9fcf..c2a1f49979 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -46,15 +46,15 @@ jobs: run: | python -m venv env source env/bin/activate - python -m pip3 install --upgrade pip - python -m pip3 install ${{ matrix.torch-spec }} - python -m pip3 install -r requirements.txt - python -m pip3 install -r dev-requirements.txt + python -m pip install --upgrade pip + python -m pip install ${{ matrix.torch-spec }} + python -m pip install -r requirements.txt + python -m pip install -r dev-requirements.txt - name: List dependencies run: | source env/bin/activate - python -m pip3 list + python -m pip list which python @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python -m pip3 install . + python -m pip install . - name: Run tests run: | From 626f1c2cc3081894d68c08459867678e0d061c53 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:45:33 -0700 Subject: [PATCH 38/76] reshuffling torch install --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index c2a1f49979..1023f899ec 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -47,9 +47,9 @@ jobs: python -m venv env source env/bin/activate python -m pip install --upgrade pip - python -m pip install ${{ matrix.torch-spec }} python -m pip install -r requirements.txt python -m pip install -r dev-requirements.txt + python -m pip install ${{ matrix.torch-spec }} - name: List dependencies run: | From e21ce5f0847624a544e4b64be407d8eac630d510 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:48:55 -0700 Subject: [PATCH 39/76] no deps? --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1023f899ec..52716d4879 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python -m pip install . + python -m pip install --no-deps . - name: Run tests run: | From ed83c1728ba2b054b301bc2f6a7faf6ad17b0dc0 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Mon, 15 Apr 2024 17:52:15 -0700 Subject: [PATCH 40/76] revert nodeps --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 52716d4879..1023f899ec 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python -m pip install --no-deps . + python -m pip install . - name: Run tests run: | From ea93b84ee798cf986649d9d238e233696246175e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 09:39:23 -0700 Subject: [PATCH 41/76] ad --- .github/workflows/regression_test.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1023f899ec..b31c450bf8 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -13,15 +13,15 @@ jobs: strategy: matrix: include: - - name: CUDA 2.2.2 - runs-on: 4-core-ubuntu-gpu-t4 - torch-spec: 'torch==2.2.2' - - name: CUDA 2.3 RC - runs-on: 4-core-ubuntu-gpu-t4 - torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' - - name: CUDA Nightly - runs-on: 4-core-ubuntu-gpu-t4 - torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' + # - name: CUDA 2.2.2 + # runs-on: 4-core-ubuntu-gpu-t4 + # torch-spec: 'torch==2.2.2' + # - name: CUDA 2.3 RC + # runs-on: 4-core-ubuntu-gpu-t4 + # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' + # - name: CUDA Nightly + # runs-on: 4-core-ubuntu-gpu-t4 + # torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' - name: CPU 2.2.2 runs-on: 32-core-ubuntu torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python -m pip install . + python setup.py install - name: Run tests run: | From 1197e993b202dba4ab4d8b99a65abd9ec7df584b Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 09:43:34 -0700 Subject: [PATCH 42/76] bla --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index b31c450bf8..d06703272a 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -62,7 +62,7 @@ jobs: run: | source env/bin/activate python -c "import torch; print(torch.__version__)" - python setup.py install + python -m pip install . - name: Run tests run: | From 55b0c262c8f9a9dc645bc2a1cfedc1502fef7ebb Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 09:57:05 -0700 Subject: [PATCH 43/76] bla --- setup.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index ffd05dbbd2..a9c0d0a504 100644 --- a/setup.py +++ b/setup.py @@ -8,14 +8,7 @@ from datetime import datetime from setuptools import find_packages, setup -import torch -from torch.utils.cpp_extension import ( -CppExtension, -CUDAExtension, -BuildExtension, -CUDA_HOME, -) current_date = datetime.now().strftime("%Y.%m.%d") @@ -32,7 +25,20 @@ def read_requirements(file_path): # Version is year.month.date if using nightlies version = current_date if package_name == "torchao-nightly" else "0.1" +def BuildExtension(*args, **kwargs): + import torch + from torch.utils.cpp_extension import BuildExtension as BE + return BE(*args, **kwargs) + def get_extensions(): + import torch + + from torch.utils.cpp_extension import ( + CppExtension, + CUDAExtension, + BuildExtension, + CUDA_HOME, + ) debug_mode = os.getenv('DEBUG', '0') == '1' if debug_mode: @@ -89,6 +95,7 @@ def get_extensions(): }, ext_modules=get_extensions(), install_requires=read_requirements("requirements.txt"), + setup_requires=['torch'], description="Package for applying ao techniques to GPU models", long_description=open("README.md").read(), long_description_content_type="text/markdown", From 77c6645991c7782ac24dc83e61344b0bf78959c9 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 14:11:00 -0700 Subject: [PATCH 44/76] lazy --- setup.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index a9c0d0a504..2e50a3e29a 100644 --- a/setup.py +++ b/setup.py @@ -9,11 +9,8 @@ from setuptools import find_packages, setup - - current_date = datetime.now().strftime("%Y.%m.%d") - def read_requirements(file_path): with open(file_path, "r") as file: return file.read().splitlines() @@ -25,6 +22,8 @@ def read_requirements(file_path): # Version is year.month.date if using nightlies version = current_date if package_name == "torchao-nightly" else "0.1" + + def BuildExtension(*args, **kwargs): import torch from torch.utils.cpp_extension import BuildExtension as BE @@ -62,7 +61,6 @@ def get_extensions(): extra_compile_args["nvcc"].append("-g") extra_link_args.extend(["-O0", "-g"]) - # this_dir = os.path.dirname(os.path.abspath(__file__)) this_dir = os.path.dirname(os.path.curdir) extensions_dir = os.path.join(this_dir, "torchao", "csrc") sources = list(glob.glob(os.path.join(extensions_dir, "*.cpp"))) @@ -84,7 +82,6 @@ def get_extensions(): return ext_modules - setup( name=package_name, version=version, From 6a1c04c70de54f1de62c1ef72821104b6bd10740 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 14:33:17 -0700 Subject: [PATCH 45/76] use conda and cuda toolkit --- .github/workflows/regression_test.yml | 58 ++++++++++++++------------- setup.py | 17 +++----- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d06703272a..d466bd5094 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -13,58 +13,60 @@ jobs: strategy: matrix: include: - # - name: CUDA 2.2.2 - # runs-on: 4-core-ubuntu-gpu-t4 - # torch-spec: 'torch==2.2.2' - # - name: CUDA 2.3 RC - # runs-on: 4-core-ubuntu-gpu-t4 - # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' - # - name: CUDA Nightly - # runs-on: 4-core-ubuntu-gpu-t4 - # torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' - name: CPU 2.2.2 runs-on: 32-core-ubuntu - torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' + torch-spec: 'torch==2.2.2' - name: CPU 2.3 RC runs-on: 32-core-ubuntu - torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cpu' + torch-spec: 'torch==2.3.0' - name: Nightly CPU runs-on: 32-core-ubuntu - torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' + torch-spec: 'torch' + - name: CUDA 2.2.2 + runs-on: 4-core-ubuntu-gpu-t4 + torch-spec: 'torch==2.2.2' + - name: CUDA 2.3 RC + runs-on: 4-core-ubuntu-gpu-t4 + torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' + - name: CUDA Nightly + runs-on: 4-core-ubuntu-gpu-t4 + torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' + runs-on: ${{ matrix.runs-on }} - # continue-on-error: true steps: - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true python-version: '3.9' + activate-environment: test-env + environment-file: environment.yml + use-only-tar-bz2: true # optional: use only bzip2 archives, smaller bandwidth usage + + - name: Install CUDA Toolkit + run: conda install -c nvidia/label/cuda-12.1.0 cuda-toolkit - - name: Install dependencies + - name: Install PyTorch run: | - python -m venv env - source env/bin/activate - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r dev-requirements.txt - python -m pip install ${{ matrix.torch-spec }} + conda activate test-env + pip install --pre -f https://download.pytorch.org/whl/nightly/cu113 ${MATRIX.TORCH_SPEC} - name: List dependencies run: | - source env/bin/activate - python -m pip list + conda activate test-env + pip list which python - - name: Install package run: | - source env/bin/activate + conda activate test-env python -c "import torch; print(torch.__version__)" - python -m pip install . + pip install . - name: Run tests run: | - source env/bin/activate + conda activate test-env pytest test --verbose -s diff --git a/setup.py b/setup.py index 2e50a3e29a..4ca27eb5b4 100644 --- a/setup.py +++ b/setup.py @@ -22,27 +22,22 @@ def read_requirements(file_path): # Version is year.month.date if using nightlies version = current_date if package_name == "torchao-nightly" else "0.1" +import torch - -def BuildExtension(*args, **kwargs): - import torch - from torch.utils.cpp_extension import BuildExtension as BE - return BE(*args, **kwargs) - -def get_extensions(): - import torch - - from torch.utils.cpp_extension import ( +from torch.utils.cpp_extension import ( CppExtension, CUDAExtension, BuildExtension, CUDA_HOME, - ) +) + +def get_extensions(): debug_mode = os.getenv('DEBUG', '0') == '1' if debug_mode: print("Compiling in debug mode") + # TODO: And cudatoolkit is available use_cuda = torch.cuda.is_available() and CUDA_HOME is not None extension = CUDAExtension if use_cuda else CppExtension From 7225bae57c96fac927755e2664b4c68bf4596256 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 15:57:03 -0700 Subject: [PATCH 46/76] push --- .github/workflows/regression_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d466bd5094..361d02f030 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -43,7 +43,6 @@ jobs: auto-update-conda: true python-version: '3.9' activate-environment: test-env - environment-file: environment.yml use-only-tar-bz2: true # optional: use only bzip2 archives, smaller bandwidth usage - name: Install CUDA Toolkit From 8d019fa420926d9d28021357919f4d717e292e41 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 15:59:19 -0700 Subject: [PATCH 47/76] update --- .github/workflows/regression_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 361d02f030..d6a472292e 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -40,6 +40,7 @@ jobs: - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 with: + miniconda-version: "latest" auto-update-conda: true python-version: '3.9' activate-environment: test-env From e9ccf97651422e8bf0c860d61a84160e54be46b8 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:04:54 -0700 Subject: [PATCH 48/76] 1 more try --- .github/workflows/regression_test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d6a472292e..39a5679198 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -51,22 +51,18 @@ jobs: - name: Install PyTorch run: | - conda activate test-env pip install --pre -f https://download.pytorch.org/whl/nightly/cu113 ${MATRIX.TORCH_SPEC} - name: List dependencies run: | - conda activate test-env pip list which python - name: Install package run: | - conda activate test-env python -c "import torch; print(torch.__version__)" pip install . - name: Run tests run: | - conda activate test-env pytest test --verbose -s From ee0d473f98bfcc0ed3fd73505ecc4ca5a9a31fbe Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:10:27 -0700 Subject: [PATCH 49/76] push --- .github/workflows/regression_test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 39a5679198..0ca429800a 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -49,9 +49,11 @@ jobs: - name: Install CUDA Toolkit run: conda install -c nvidia/label/cuda-12.1.0 cuda-toolkit - - name: Install PyTorch + - name: Install PyTorch and other dependencies run: | - pip install --pre -f https://download.pytorch.org/whl/nightly/cu113 ${MATRIX.TORCH_SPEC} + pip install ${{ matrix.torch-spec }} + pip install -r requirements.txt + pip install -r dev-requirements.txt - name: List dependencies run: | From 41ee0ca2ca9300e809453af955c54a9a917f8f69 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:15:59 -0700 Subject: [PATCH 50/76] bla --- .github/workflows/regression_test.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 0ca429800a..918dd2aaf0 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -13,15 +13,6 @@ jobs: strategy: matrix: include: - - name: CPU 2.2.2 - runs-on: 32-core-ubuntu - torch-spec: 'torch==2.2.2' - - name: CPU 2.3 RC - runs-on: 32-core-ubuntu - torch-spec: 'torch==2.3.0' - - name: Nightly CPU - runs-on: 32-core-ubuntu - torch-spec: 'torch' - name: CUDA 2.2.2 runs-on: 4-core-ubuntu-gpu-t4 torch-spec: 'torch==2.2.2' @@ -31,6 +22,15 @@ jobs: - name: CUDA Nightly runs-on: 4-core-ubuntu-gpu-t4 torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' + - name: CPU 2.2.2 + runs-on: 32-core-ubuntu + torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' + - name: CPU 2.3 RC + runs-on: 32-core-ubuntu + torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cpu' + - name: Nightly CPU + runs-on: 32-core-ubuntu + torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} @@ -51,6 +51,7 @@ jobs: - name: Install PyTorch and other dependencies run: | + python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt From 8935acdd4f60ebad036ac0296a46a7b3d0373e7f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:22:00 -0700 Subject: [PATCH 51/76] bla --- .github/workflows/regression_test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 918dd2aaf0..00668ab0b6 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -51,6 +51,8 @@ jobs: - name: Install PyTorch and other dependencies run: | + source $CONDA/etc/profile.d/conda.sh + conda activate test-env python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt @@ -58,14 +60,17 @@ jobs: - name: List dependencies run: | + conda activate test-env pip list which python - name: Install package run: | + conda activate test-env python -c "import torch; print(torch.__version__)" pip install . - name: Run tests run: | + conda activate test-env pytest test --verbose -s From 36350b87d1c7c09fcc2f68c4f00e6a2bef1c00ce Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:26:19 -0700 Subject: [PATCH 52/76] conda init --- .github/workflows/regression_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 00668ab0b6..9354b79e52 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -52,6 +52,7 @@ jobs: - name: Install PyTorch and other dependencies run: | source $CONDA/etc/profile.d/conda.sh + conda init conda activate test-env python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} From 794e3652668c16b85b64ece9c61df045329f7a3e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 16:30:46 -0700 Subject: [PATCH 53/76] clowntown --- .github/workflows/regression_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 9354b79e52..5133e8d8f3 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -61,17 +61,20 @@ jobs: - name: List dependencies run: | + conda init conda activate test-env pip list which python - name: Install package run: | + conda init conda activate test-env python -c "import torch; print(torch.__version__)" pip install . - name: Run tests run: | + conda init conda activate test-env pytest test --verbose -s From de11d5698446be8ae5bbaad55fae93ce3849af6d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 17:38:42 -0700 Subject: [PATCH 54/76] this works locally --- .github/workflows/regression_test.yml | 32 ++++----------------------- pyproject.toml | 3 +++ 2 files changed, 7 insertions(+), 28 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 5133e8d8f3..65ee183f11 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -31,50 +31,26 @@ jobs: - name: Nightly CPU runs-on: 32-core-ubuntu torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' - runs-on: ${{ matrix.runs-on }} - steps: - uses: actions/checkout@v2 - - name: Set up Conda - uses: conda-incubator/setup-miniconda@v2 + - name: Set up Python + uses: actions/setup-python@v2 with: - miniconda-version: "latest" - auto-update-conda: true python-version: '3.9' - activate-environment: test-env - use-only-tar-bz2: true # optional: use only bzip2 archives, smaller bandwidth usage - - - name: Install CUDA Toolkit - run: conda install -c nvidia/label/cuda-12.1.0 cuda-toolkit - - name: Install PyTorch and other dependencies + - name: Install dependencies run: | - source $CONDA/etc/profile.d/conda.sh - conda init - conda activate test-env python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt - - name: List dependencies - run: | - conda init - conda activate test-env - pip list - which python - - name: Install package run: | - conda init - conda activate test-env - python -c "import torch; print(torch.__version__)" pip install . - name: Run tests run: | - conda init - conda activate test-env - pytest test --verbose -s + pytest test --verbose -s \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..e0714967e1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel", "torch"] +build-backend = "setuptools.build_meta" From 54eb2d101d6a28ec23526eccdbacc8b3f4815b61 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:01:07 -0700 Subject: [PATCH 55/76] update --- .github/workflows/regression_test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 65ee183f11..6125934387 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -34,6 +34,11 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 + + - name: Install cuda-toolkit + uses: Jimver/cuda-toolkit@v0.2.14 + with: + cuda: '12.1.0' - name: Set up Python uses: actions/setup-python@v2 From bd0347a85b4b8a25aecb6426612a284a520f500f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:06:02 -0700 Subject: [PATCH 56/76] remove cache --- .github/workflows/regression_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 6125934387..ff10aa5947 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -39,6 +39,8 @@ jobs: uses: Jimver/cuda-toolkit@v0.2.14 with: cuda: '12.1.0' + use-github-cache: false + use-local-cache: false - name: Set up Python uses: actions/setup-python@v2 From 0c514855f6a5a7ffb8e8aecbfabbeb504ffd6f7c Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:11:19 -0700 Subject: [PATCH 57/76] push --- .github/workflows/regression_test.yml | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index ff10aa5947..d9523811f5 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -13,24 +13,24 @@ jobs: strategy: matrix: include: - - name: CUDA 2.2.2 - runs-on: 4-core-ubuntu-gpu-t4 - torch-spec: 'torch==2.2.2' - - name: CUDA 2.3 RC - runs-on: 4-core-ubuntu-gpu-t4 - torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' + # - name: CUDA 2.2.2 + # runs-on: 4-core-ubuntu-gpu-t4 + # torch-spec: 'torch==2.2.2' + # - name: CUDA 2.3 RC + # runs-on: 4-core-ubuntu-gpu-t4 + # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' - name: CUDA Nightly runs-on: 4-core-ubuntu-gpu-t4 torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' - - name: CPU 2.2.2 - runs-on: 32-core-ubuntu - torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' - - name: CPU 2.3 RC - runs-on: 32-core-ubuntu - torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cpu' - - name: Nightly CPU - runs-on: 32-core-ubuntu - torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' + # - name: CPU 2.2.2 + # runs-on: 32-core-ubuntu + # torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' + # - name: CPU 2.3 RC + # runs-on: 32-core-ubuntu + # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cpu' + # - name: Nightly CPU + # runs-on: 32-core-ubuntu + # torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 From 2ee80d71184d59cd3613c6d0877d3f0ba3f84c25 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:17:53 -0700 Subject: [PATCH 58/76] alternate cuda install command --- .github/workflows/regression_test.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index d9523811f5..dacd2db113 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -35,12 +35,15 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install cuda-toolkit - uses: Jimver/cuda-toolkit@v0.2.14 - with: - cuda: '12.1.0' - use-github-cache: false - use-local-cache: false + - name: Set up CUDA + run: | + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin + mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub + add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" + apt-get -y install cuda-12-1 + env: + CUDA_VERSION: 12.1 - name: Set up Python uses: actions/setup-python@v2 From 1b3bc788aa3aaf6f4a1c2774fa7a7ac032e63bc2 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:19:42 -0700 Subject: [PATCH 59/76] bla --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index dacd2db113..cf9b7e39da 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -35,7 +35,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up CUDA + - name: Set up CUDA run: | wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 From 9f0dc3594dcaf4350e9c22a3cba21d703d6d9b3d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Tue, 16 Apr 2024 18:21:13 -0700 Subject: [PATCH 60/76] bla --- .github/workflows/regression_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index cf9b7e39da..020784addc 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -38,10 +38,10 @@ jobs: - name: Set up CUDA run: | wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin - mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub - add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" - apt-get -y install cuda-12-1 + sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 + sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub + sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" + sudo apt-get -y install cuda-12-1 env: CUDA_VERSION: 12.1 From b71570f1382ae1beebfed1127e612e85bc96bf11 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 09:41:30 -0700 Subject: [PATCH 61/76] update --- .github/workflows/regression_test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 020784addc..ee80f8a475 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -34,16 +34,16 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 - - - name: Set up CUDA - run: | - wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin - sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 - sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub - sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" - sudo apt-get -y install cuda-12-1 - env: - CUDA_VERSION: 12.1 + + # - name: Set up CUDA + # run: | + # wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin + # sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 + # sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub + # sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" + # sudo apt-get -y install cuda-12-1 + # env: + # CUDA_VERSION: 12.1 - name: Set up Python uses: actions/setup-python@v2 @@ -59,8 +59,8 @@ jobs: - name: Install package run: | - pip install . + pip install . -vvv - name: Run tests run: | - pytest test --verbose -s \ No newline at end of file + pytest test --verbose -s From 1868f7dd76bf9bbedbb9b903cb40984b0ddb20d9 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 10:10:53 -0700 Subject: [PATCH 62/76] push --- .github/workflows/regression_test.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index ee80f8a475..20d8a4ab40 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -22,6 +22,7 @@ jobs: - name: CUDA Nightly runs-on: 4-core-ubuntu-gpu-t4 torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' + cuda: '12.0.0' # - name: CPU 2.2.2 # runs-on: 32-core-ubuntu # torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' @@ -35,15 +36,12 @@ jobs: steps: - uses: actions/checkout@v2 - # - name: Set up CUDA - # run: | - # wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin - # sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 - # sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub - # sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" - # sudo apt-get -y install cuda-12-1 - # env: - # CUDA_VERSION: 12.1 + - uses: Jimver/cuda-toolkit@v0.2.11 + id: cuda-toolkit + with: + cuda: ${{ matrix.cuda }} + method: network + sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' - name: Set up Python uses: actions/setup-python@v2 From d94aed34a691801c8da826c59901328af37366dc Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 10:20:38 -0700 Subject: [PATCH 63/76] bla --- .github/workflows/regression_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 20d8a4ab40..f67d79356e 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -41,7 +41,6 @@ jobs: with: cuda: ${{ matrix.cuda }} method: network - sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' - name: Set up Python uses: actions/setup-python@v2 From bd207d49d0c59e2e3cf30500912f77d39091a674 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 10:35:30 -0700 Subject: [PATCH 64/76] bla --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index f67d79356e..9093aaafb0 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -22,7 +22,7 @@ jobs: - name: CUDA Nightly runs-on: 4-core-ubuntu-gpu-t4 torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' - cuda: '12.0.0' + cuda: '12.1.0' # - name: CPU 2.2.2 # runs-on: 32-core-ubuntu # torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' From d3169bdbf3619b539d14d5f108726a677a7dd764 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 10:59:19 -0700 Subject: [PATCH 65/76] bla --- .github/workflows/regression_test.yml | 16 +++++++++++----- pyproject.toml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 9093aaafb0..9bb8171afd 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -33,14 +33,20 @@ jobs: # runs-on: 32-core-ubuntu # torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} + container: + image: nvidia/cuda:12.1.0-devel-ubuntu20.04 + ports: + - 80 + options: --gpus all --shm-size "8G" + steps: - uses: actions/checkout@v2 - - uses: Jimver/cuda-toolkit@v0.2.11 - id: cuda-toolkit - with: - cuda: ${{ matrix.cuda }} - method: network + # - uses: Jimver/cuda-toolkit@v0.2.11 + # id: cuda-toolkit + # with: + # cuda: ${{ matrix.cuda }} + # method: network - name: Set up Python uses: actions/setup-python@v2 diff --git a/pyproject.toml b/pyproject.toml index e0714967e1..c0cc0f5b09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "torch"] +requires = ["setuptools", "wheel", "torch", "ninja"] build-backend = "setuptools.build_meta" From b9f8631535252611bd4b4e2410eb77ebbc0b38ba Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 11:12:59 -0700 Subject: [PATCH 66/76] bla --- .github/workflows/regression_test.yml | 30 +++++++-------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 9bb8171afd..e8bca2d483 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -13,25 +13,10 @@ jobs: strategy: matrix: include: - # - name: CUDA 2.2.2 - # runs-on: 4-core-ubuntu-gpu-t4 - # torch-spec: 'torch==2.2.2' - # - name: CUDA 2.3 RC - # runs-on: 4-core-ubuntu-gpu-t4 - # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cu121' - name: CUDA Nightly runs-on: 4-core-ubuntu-gpu-t4 torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' cuda: '12.1.0' - # - name: CPU 2.2.2 - # runs-on: 32-core-ubuntu - # torch-spec: 'torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu' - # - name: CPU 2.3 RC - # runs-on: 32-core-ubuntu - # torch-spec: 'torch==2.3.0 --index-url https://download.pytorch.org/whl/test/cpu' - # - name: Nightly CPU - # runs-on: 32-core-ubuntu - # torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' runs-on: ${{ matrix.runs-on }} container: image: nvidia/cuda:12.1.0-devel-ubuntu20.04 @@ -42,19 +27,19 @@ jobs: steps: - uses: actions/checkout@v2 - # - uses: Jimver/cuda-toolkit@v0.2.11 - # id: cuda-toolkit - # with: - # cuda: ${{ matrix.cuda }} - # method: network - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.9' + - name: Set up virtual environment + run: | + python -m venv venv + source venv/bin/activate + - name: Install dependencies run: | + source venv/bin/activate python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt @@ -66,4 +51,5 @@ jobs: - name: Run tests run: | - pytest test --verbose -s + source venv/bin/activate + pytest test test/test_ops.py From e38e69eefe212244d81c0671ab6c86b9601c1369 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 11:14:15 -0700 Subject: [PATCH 67/76] bla --- .github/workflows/regression_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index e8bca2d483..038926ecf6 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -52,4 +52,4 @@ jobs: - name: Run tests run: | source venv/bin/activate - pytest test test/test_ops.py + pytest test/test_ops.py From 065b93ea1dd8c1ca777d53fda117f670574afedf Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 11:21:37 -0700 Subject: [PATCH 68/76] bla --- .github/workflows/regression_test.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 038926ecf6..1ff0f6fe0e 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -32,18 +32,20 @@ jobs: with: python-version: '3.9' - - name: Set up virtual environment - run: | - python -m venv venv - source venv/bin/activate + - name: Setup conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + activate-environment: test - name: Install dependencies run: | - source venv/bin/activate python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt + conda install nvidia/label/cuda-12.1.0::cuda-toolkit - name: Install package run: | @@ -51,5 +53,4 @@ jobs: - name: Run tests run: | - source venv/bin/activate pytest test/test_ops.py From 83cb732c40b01368d9dbf8110d833707e326fd8e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 12:36:53 -0700 Subject: [PATCH 69/76] yolo --- .github/workflows/regression_test.yml | 13 ++++++------- pyproject.toml | 2 +- requirements.txt | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 1ff0f6fe0e..06f81873f9 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -18,11 +18,11 @@ jobs: torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' cuda: '12.1.0' runs-on: ${{ matrix.runs-on }} - container: - image: nvidia/cuda:12.1.0-devel-ubuntu20.04 - ports: - - 80 - options: --gpus all --shm-size "8G" + # container: + # image: nvidia/cuda:12.1.0-devel-ubuntu20.04 + # ports: + # - 80 + # options: --gpus all --shm-size "8G" steps: - uses: actions/checkout@v2 @@ -41,7 +41,6 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt @@ -49,7 +48,7 @@ jobs: - name: Install package run: | - pip install . -vvv + python setup.py install - name: Run tests run: | diff --git a/pyproject.toml b/pyproject.toml index c0cc0f5b09..1f66e9425a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "torch", "ninja"] +requires = ["setuptools", "wheel", "ninja"] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 1420797da0..9a88bb189a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -torch numpy sentencepiece packaging From 857845ce98894ba920d7bf7641b1705c69673d7c Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 12:41:49 -0700 Subject: [PATCH 70/76] yolo --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index eb5a3a48b0..eb5ba9e3be 100644 --- a/setup.py +++ b/setup.py @@ -87,7 +87,6 @@ def get_extensions(): }, ext_modules=get_extensions(), install_requires=read_requirements("requirements.txt"), - setup_requires=['torch'], extras_require={"dev": read_requirements("dev-requirements.txt")}, description="Package for applying ao techniques to GPU models", long_description=open("README.md").read(), From c0077d7cbd184b42938395d0b3d0475c66382cab Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 12:51:27 -0700 Subject: [PATCH 71/76] yolo --- .github/workflows/regression_test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 06f81873f9..255124a19d 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -18,11 +18,11 @@ jobs: torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cu121' cuda: '12.1.0' runs-on: ${{ matrix.runs-on }} - # container: - # image: nvidia/cuda:12.1.0-devel-ubuntu20.04 - # ports: - # - 80 - # options: --gpus all --shm-size "8G" + container: + image: nvidia/cuda:12.1.0-devel-ubuntu20.04 + ports: + - 80 + options: --gpus all --shm-size "8G" steps: - uses: actions/checkout@v2 @@ -32,19 +32,19 @@ jobs: with: python-version: '3.9' - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: test + # - name: Setup conda env + # uses: conda-incubator/setup-miniconda@v2 + # with: + # auto-update-conda: true + # miniconda-version: "latest" + # activate-environment: test - name: Install dependencies run: | pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt - conda install nvidia/label/cuda-12.1.0::cuda-toolkit + # conda install nvidia/label/cuda-12.1.0::cuda-toolkit - name: Install package run: | From 1dfd56d5943cb2270cbd31c47b465283f727ad7f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 17 Apr 2024 12:55:39 -0700 Subject: [PATCH 72/76] yolo --- .github/workflows/regression_test.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 255124a19d..309df592c6 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -32,19 +32,19 @@ jobs: with: python-version: '3.9' - # - name: Setup conda env - # uses: conda-incubator/setup-miniconda@v2 - # with: - # auto-update-conda: true - # miniconda-version: "latest" - # activate-environment: test + - name: Setup conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + activate-environment: test - name: Install dependencies run: | pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt - # conda install nvidia/label/cuda-12.1.0::cuda-toolkit + conda install nvidia/label/cuda-12.1.0::cuda-toolkit - name: Install package run: | From 5f015c78906cb88a5815da5c9adcc69b012a843d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Thu, 25 Apr 2024 16:07:07 -0700 Subject: [PATCH 73/76] yolo --- .github/workflows/regression_test.yml | 2 +- dev-requirements.txt | 2 +- requirements.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 8002c6f2e9..2414899c5b 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -39,7 +39,7 @@ jobs: - name: Nightly CPU runs-on: 32-core-ubuntu torch-spec: '--pre torch --index-url https://download.pytorch.org/whl/nightly/cpu' - + runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v2 diff --git a/dev-requirements.txt b/dev-requirements.txt index 23ab838a48..8a8ed1e491 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,8 +3,8 @@ expecttest parameterized packaging transformers -ninja bitsandbytes #needed for testing triton quant / dequant ops for 8-bit optimizers matplotlib # needed for triton benchmarking pandas # also for triton benchmarking transformers #for galore testing +ninja diff --git a/requirements.txt b/requirements.txt index 9a88bb189a..1420797da0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +torch numpy sentencepiece packaging From 0d516e54fb876b7b608257e83173429f73a4ca7a Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Thu, 25 Apr 2024 16:14:34 -0700 Subject: [PATCH 74/76] yolo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1f66e9425a..edf5df1398 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "ninja"] +requires = ["setuptools", "wheel", "ninja", "torch"] build-backend = "setuptools.build_meta" From 756a2944240f6459882ed81eabf566a0d2470d71 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Thu, 25 Apr 2024 16:26:13 -0700 Subject: [PATCH 75/76] yolo --- .github/workflows/regression_test.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index fa2f58bd95..05b9ece53c 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -62,5 +62,5 @@ jobs: pip install ${{ matrix.torch-spec }} pip install -r requirements.txt pip install -r dev-requirements.txt - pip install . + python setup.py install pytest test --verbose -s diff --git a/pyproject.toml b/pyproject.toml index edf5df1398..1f66e9425a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "ninja", "torch"] +requires = ["setuptools", "wheel", "ninja"] build-backend = "setuptools.build_meta" From 0ba0006eb704dea33becec82b3f34512fe8a6dff Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Thu, 25 Apr 2024 16:29:14 -0700 Subject: [PATCH 76/76] yolo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1f66e9425a..edf5df1398 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "ninja"] +requires = ["setuptools", "wheel", "ninja", "torch"] build-backend = "setuptools.build_meta"