From 3ca6d1bb7237bba0d83e6ff15d25c2edb7f8b92b Mon Sep 17 00:00:00 2001 From: LeiWang1999 Date: Thu, 13 Feb 2025 09:32:32 +0000 Subject: [PATCH 1/3] Remove attrs dependency and migrate to dataclasses - Remove attrs from base requirements and constraints - Replace attr.s decorator with @dataclass in memory_plan.py - Simplify Region class definition using dataclass --- python/gen_requirements.py | 2 -- python/tvm/relay/transform/memory_plan.py | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/python/gen_requirements.py b/python/gen_requirements.py index 5919d2a9c787..d22544db484b 100644 --- a/python/gen_requirements.py +++ b/python/gen_requirements.py @@ -63,7 +63,6 @@ ( "Base requirements needed to install tvm", [ - "attrs", "cloudpickle", "decorator", "ml_dtypes", @@ -236,7 +235,6 @@ # here. Include a comment linking to context or explaining why the constraint is in place. CONSTRAINTS = [ ("astroid", None), - ("attrs", None), ("autodocsumm", None), ("black", "==20.8b1"), ("cloudpickle", None), diff --git a/python/tvm/relay/transform/memory_plan.py b/python/tvm/relay/transform/memory_plan.py index 948a79079ecd..7bd85eea0255 100644 --- a/python/tvm/relay/transform/memory_plan.py +++ b/python/tvm/relay/transform/memory_plan.py @@ -20,7 +20,7 @@ """ from typing import Optional, Dict, List, Tuple from collections import defaultdict -import attr +from dataclasses import dataclass from ..expr_functor import ExprMutator from .. import op, expr @@ -41,7 +41,7 @@ def is_primitive(call): ) -@attr.s(auto_attribs=True) +@dataclass class Region: """ Represents a control-free allocation region. @@ -49,7 +49,6 @@ class Region: The below pass groups sets of allocations into regions, then replaces the region with a single allocation. """ - var: expr.Var size: expr.Expr alignment: Optional[expr.Expr] From 1e455a60d47580530de35eba4285c8bbbf622c61 Mon Sep 17 00:00:00 2001 From: LeiWang1999 Date: Thu, 13 Feb 2025 09:34:08 +0000 Subject: [PATCH 2/3] Remove attrs dependency from installation scripts and documentation - Remove attrs from conda recipe requirements - Remove attrs from Docker installation scripts for Ubuntu - Update documentation to remove attrs from pip install instructions --- conda/recipe/meta.yaml | 1 - docker/install/ubuntu2004_install_python_package.sh | 1 - docker/install/ubuntu_install_python_package.sh | 1 - docs/install/from_source.rst | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml index 624641829c37..e7294b71b2cd 100644 --- a/conda/recipe/meta.yaml +++ b/conda/recipe/meta.yaml @@ -86,7 +86,6 @@ outputs: - psutil - scipy - typing_extensions - - attrs - ml_dtypes - tornado - cloudpickle diff --git a/docker/install/ubuntu2004_install_python_package.sh b/docker/install/ubuntu2004_install_python_package.sh index 05365bb87668..b79221885db0 100644 --- a/docker/install/ubuntu2004_install_python_package.sh +++ b/docker/install/ubuntu2004_install_python_package.sh @@ -23,7 +23,6 @@ set -o pipefail # install libraries for python package on ubuntu pip3 install --upgrade \ "Pygments>=2.4.0" \ - attrs \ cloudpickle \ cython \ decorator \ diff --git a/docker/install/ubuntu_install_python_package.sh b/docker/install/ubuntu_install_python_package.sh index 593ba15f5947..ba02b9ffdc5b 100755 --- a/docker/install/ubuntu_install_python_package.sh +++ b/docker/install/ubuntu_install_python_package.sh @@ -23,7 +23,6 @@ set -o pipefail # install libraries for python package on ubuntu pip3 install --upgrade \ "Pygments>=2.4.0" \ - attrs \ cloudpickle \ cython \ decorator \ diff --git a/docs/install/from_source.rst b/docs/install/from_source.rst index 8e2d94db5f9a..86d11e9a1b36 100644 --- a/docs/install/from_source.rst +++ b/docs/install/from_source.rst @@ -209,7 +209,7 @@ The following commands can be used to install the extra Python dependencies: .. code:: bash - pip3 install numpy decorator attrs + pip3 install numpy decorator * If you want to use RPC Tracker From 514b129bc7201317dbb76cf3b4f7a59ecf1d5a22 Mon Sep 17 00:00:00 2001 From: LeiWang1999 Date: Thu, 13 Feb 2025 10:51:42 +0000 Subject: [PATCH 3/3] lint fix --- python/tvm/relay/transform/memory_plan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/tvm/relay/transform/memory_plan.py b/python/tvm/relay/transform/memory_plan.py index 7bd85eea0255..814adb2b4ff1 100644 --- a/python/tvm/relay/transform/memory_plan.py +++ b/python/tvm/relay/transform/memory_plan.py @@ -49,6 +49,7 @@ class Region: The below pass groups sets of allocations into regions, then replaces the region with a single allocation. """ + var: expr.Var size: expr.Expr alignment: Optional[expr.Expr]