From 074a5c0c9b94cb3708e3ce77e8869b0ae77b4701 Mon Sep 17 00:00:00 2001 From: PyTorch MergeBot Date: Mon, 15 Jul 2024 19:42:11 +0000 Subject: [PATCH] Revert "[BE] bump `optree` version to 0.12.1 (#130139)" This reverts commit 8fcb156e8b5697a8f292db6db2a1803c5f4ce2d7. Reverted https://github.com/pytorch/pytorch/pull/130139 on behalf of https://github.com/clee2000 due to broke inductor/test_torchinductor_codegen_dynamic_shapes.py and test_sympy_utils.py https://hud.pytorch.org/pytorch/pytorch/commit/8fcb156e8b5697a8f292db6db2a1803c5f4ce2d7 ([comment](https://github.com/pytorch/pytorch/pull/130139#issuecomment-2229248447)) --- .ci/docker/requirements-ci.txt | 4 ++-- .github/requirements/pip-requirements-iOS.txt | 2 +- .github/requirements/pip-requirements-macOS.txt | 2 +- .github/workflows/_win-test.yml | 2 +- .lintrunner.toml | 2 +- requirements.txt | 2 +- setup.py | 2 +- test/functorch/test_eager_transforms.py | 2 +- test/profiler/test_profiler.py | 2 +- test/test_mps.py | 5 +++-- test/test_stateless.py | 2 +- test/test_testing.py | 2 +- torch/utils/_cxx_pytree.py | 2 +- 13 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.ci/docker/requirements-ci.txt b/.ci/docker/requirements-ci.txt index 0f4031d26193..f1b3d9800964 100644 --- a/.ci/docker/requirements-ci.txt +++ b/.ci/docker/requirements-ci.txt @@ -134,9 +134,9 @@ opt-einsum==3.3 #Pinned versions: 3.3 #test that import: test_linalg.py -optree==0.12.1 +optree==0.11.0 #Description: A library for tree manipulation -#Pinned versions: 0.12.1 +#Pinned versions: 0.11.0 #test that import: test_vmap.py, test_aotdispatch.py, test_dynamic_shapes.py, #test_pytree.py, test_ops.py, test_control_flow.py, test_modules.py, #common_utils.py, test_eager_transforms.py, test_python_dispatch.py, diff --git a/.github/requirements/pip-requirements-iOS.txt b/.github/requirements/pip-requirements-iOS.txt index 763789b7a234..01290e4c7102 100644 --- a/.github/requirements/pip-requirements-iOS.txt +++ b/.github/requirements/pip-requirements-iOS.txt @@ -1,4 +1,4 @@ # iOS simulator requirements coremltools==5.0b5 protobuf==3.20.2 -optree==0.12.1 +optree==0.11.0 diff --git a/.github/requirements/pip-requirements-macOS.txt b/.github/requirements/pip-requirements-macOS.txt index e1834fc3d3c0..f0e4890328b3 100644 --- a/.github/requirements/pip-requirements-macOS.txt +++ b/.github/requirements/pip-requirements-macOS.txt @@ -26,7 +26,7 @@ pytest-cpp==2.3.0 rockset==1.0.3 z3-solver==4.12.2.0 tensorboard==2.13.0 -optree==0.12.1 +optree==0.11.0 # NB: test_hparams_* from test_tensorboard is failing with protobuf 5.26.0 in # which the stringify metadata is wrong when escaping double quote protobuf==3.20.2 diff --git a/.github/workflows/_win-test.yml b/.github/workflows/_win-test.yml index 347355651f44..143088c195ed 100644 --- a/.github/workflows/_win-test.yml +++ b/.github/workflows/_win-test.yml @@ -188,7 +188,7 @@ jobs: run: | pushd "${PYTORCH_FINAL_PACKAGE_DIR}" # shellcheck disable=SC2046,SC2102 - python3 -mpip install $(echo *.whl)[opt-einsum,optree] optree==0.12.1 + python3 -mpip install $(echo *.whl)[opt-einsum,optree] popd .ci/pytorch/win-test.sh diff --git a/.lintrunner.toml b/.lintrunner.toml index eb626c2ba4ab..355b0a925e95 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -151,7 +151,7 @@ init_command = [ 'junitparser==2.1.1', 'rich==10.9.0', 'pyyaml==6.0.1', - 'optree==0.12.1', + 'optree==0.11.0', ] [[linter]] diff --git a/requirements.txt b/requirements.txt index 60737ddb32a4..95a30dd6e599 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,4 @@ ninja # setuptools was removed from default python install setuptools ; python_version >= "3.12" packaging -optree>=0.12.0 +optree>=0.11.0 ; python_version <= "3.12" diff --git a/setup.py b/setup.py index 0032c7c687a6..f2946f65d4fd 100644 --- a/setup.py +++ b/setup.py @@ -1199,7 +1199,7 @@ def main(): install_requires += extra_install_requires extras_require = { - "optree": ["optree>=0.12.0"], + "optree": ["optree==0.11.0"], "opt-einsum": ["opt-einsum>=3.3"], } diff --git a/test/functorch/test_eager_transforms.py b/test/functorch/test_eager_transforms.py index 104c0a129fca..31c72a17c23b 100644 --- a/test/functorch/test_eager_transforms.py +++ b/test/functorch/test_eager_transforms.py @@ -3404,7 +3404,7 @@ class TestComposability(TestCase): @onlyCPU def test_no_warning_on_import_functorch(self, device): out = subprocess.check_output( - [sys.executable, "-W", "always", "-c", "import functorch"], + [sys.executable, "-W", "all", "-c", "import functorch"], stderr=subprocess.STDOUT, cwd=os.path.dirname(os.path.realpath(__file__)), ).decode("utf-8") diff --git a/test/profiler/test_profiler.py b/test/profiler/test_profiler.py index 7c074b7b9105..c0afd559b2b0 100644 --- a/test/profiler/test_profiler.py +++ b/test/profiler/test_profiler.py @@ -1479,7 +1479,7 @@ assert KinetoStepTracker.current_step() == initial_step + 2 * niters """ try: subprocess.check_output( - [sys.executable, "-W", "always", "-c", script], + [sys.executable, "-W", "all", "-c", script], cwd=os.path.dirname(os.path.realpath(__file__)), ) except subprocess.CalledProcessError as e: diff --git a/test/test_mps.py b/test/test_mps.py index 51bbae7213ce..9fc8074f4fc9 100644 --- a/test/test_mps.py +++ b/test/test_mps.py @@ -11587,7 +11587,7 @@ class TestFallbackWarning(TestCase): # TODO: Remove once test_testing.py is running on MPS devices def test_no_warning_on_import(self): out = subprocess.check_output( - [sys.executable, "-W", "always", "-c", "import torch"], + [sys.executable, "-W", "all", "-c", "import torch"], stderr=subprocess.STDOUT, # On Windows, opening the subprocess with the default CWD makes `import torch` # fail, so just set CWD to this script's directory @@ -11629,10 +11629,11 @@ with warnings.catch_warnings(record=True) as w: if len(w) != 1: print(w) exit(2) + """ try: subprocess.check_output( - [sys.executable, '-W', 'always', '-c', script], + [sys.executable, '-W', 'all', '-c', script], stderr=subprocess.STDOUT, # On Windows, opening the subprocess with the default CWD makes `import torch` # fail, so just set CWD to this script's directory diff --git a/test/test_stateless.py b/test/test_stateless.py index 44b53e2caf0b..6256f2b55bf8 100644 --- a/test/test_stateless.py +++ b/test/test_stateless.py @@ -887,7 +887,7 @@ exit(len(w)) """ try: subprocess.check_output( - [sys.executable, '-W', 'always', '-c', script], + [sys.executable, '-W', 'all', '-c', script], stderr=subprocess.STDOUT, # On Windows, opening the subprocess with the default CWD makes `import torch` # fail, so just set CWD to this script's directory diff --git a/test/test_testing.py b/test/test_testing.py index f07a467cb812..8b4a33a3ba15 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -2216,7 +2216,7 @@ class TestImports(TestCase): @classmethod def _check_python_output(cls, program) -> str: return subprocess.check_output( - [sys.executable, "-W", "always", "-c", program], + [sys.executable, "-W", "all", "-c", program], stderr=subprocess.STDOUT, # On Windows, opening the subprocess with the default CWD makes `import torch` # fail, so just set CWD to this script's directory diff --git a/torch/utils/_cxx_pytree.py b/torch/utils/_cxx_pytree.py index 3d40724655a3..01adf0a4f9b1 100644 --- a/torch/utils/_cxx_pytree.py +++ b/torch/utils/_cxx_pytree.py @@ -273,7 +273,7 @@ def tree_flatten( >>> from collections import OrderedDict >>> tree = OrderedDict([('b', (2, [3, 4])), ('a', 1), ('c', None), ('d', 5)]) >>> tree_flatten(tree) - ([2, 3, 4, 1, None, 5], PyTreeSpec(OrderedDict({'b': (*, [*, *]), 'a': *, 'c': *, 'd': *}), NoneIsLeaf)) + ([2, 3, 4, 1, None, 5], PyTreeSpec(OrderedDict([('b', (*, [*, *])), ('a', *), ('c', *), ('d', *)]), NoneIsLeaf)) Args: tree (pytree): A pytree to flatten.