Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

An error occurs when importing Trident #94

Closed
hotstone1993 opened this issue Sep 2, 2023 · 2 comments
Closed

An error occurs when importing Trident #94

hotstone1993 opened this issue Sep 2, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@hotstone1993
Copy link

hotstone1993 commented Sep 2, 2023

🐞 Describe the bug

After building trident with the build script(install_package.sh), an error occurs when the library is imported.

>>> import trident
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/baron/dev/trident/trident/__init__.py", line 15, in <module>
    from . import function, kernel, util
  File "/home/baron/dev/trident/trident/function/__init__.py", line 15, in <module>
    from .function import *
  File "/home/baron/dev/trident/trident/function/function.py", line 19, in <module>
    from trident import operation
  File "/home/baron/dev/trident/trident/operation/__init__.py", line 15, in <module>
    from .adaptive_avg_pool2d import *
  File "/home/baron/dev/trident/trident/operation/adaptive_avg_pool2d.py", line 17, in <module>
    from trident import kernel
  File "/home/baron/dev/trident/trident/kernel/__init__.py", line 23, in <module>
    from .gelu import *
  File "/home/baron/dev/trident/trident/kernel/gelu.py", line 21, in <module>
    class GELU:
  File "/home/baron/dev/trident/trident/kernel/gelu.py", line 32, in GELU
    @triton.autotune(configs(), ["x_size"])
TypeError: 'staticmethod' object is not callable

The build was successful as shown below.

~/dev/trident/.triton/python ~/dev/trident
Already up to date.
Found existing installation: triton 2.1.0
Uninstalling triton-2.1.0:
  Successfully uninstalled triton-2.1.0
Processing /home/baron/dev/trident/.triton/python
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: filelock in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from triton==2.1.0) (3.12.3)
Requirement already satisfied: typing-extensions>=4.7.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from filelock->triton==2.1.0) (4.7.1)
Building wheels for collected packages: triton
  Building wheel for triton (pyproject.toml) ... done
  Created wheel for triton: filename=triton-2.1.0-cp38-cp38-linux_x86_64.whl size=103818846 sha256=82a3ad0fbee4aea1b92e5ef759e47e170c7866792fa8e6b144993ac7822f3b91
  Stored in directory: /tmp/pip-ephem-wheel-cache-l9b57779/wheels/60/6a/5b/828e91e92f298f2433e6489cdac57e7545431ca3c351ab973f
Successfully built triton
Installing collected packages: triton
Successfully installed triton-2.1.0
~/dev/trident
Found existing installation: trident 0.1.0
Uninstalling trident-0.1.0:
  Successfully uninstalled trident-0.1.0
Obtaining file:///home/baron/dev/trident
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: pytest in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from trident==0.1.0) (7.4.0)
Requirement already satisfied: matplotlib in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from trident==0.1.0) (3.7.2)
Requirement already satisfied: pandas in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from trident==0.1.0) (2.0.3)
Requirement already satisfied: contourpy>=1.0.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (4.42.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (1.4.5)
Requirement already satisfied: numpy>=1.20 in /home/baron/.local/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (1.21.4)
Requirement already satisfied: packaging>=20.0 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (23.0)
Requirement already satisfied: pillow>=6.2.0 in /home/baron/.local/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (9.1.0)
Requirement already satisfied: pyparsing<3.1,>=2.3.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (2.8.2)
Requirement already satisfied: importlib-resources>=3.2.0 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from matplotlib->trident==0.1.0) (6.0.1)
Requirement already satisfied: pytz>=2020.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pandas->trident==0.1.0) (2023.3)
Requirement already satisfied: tzdata>=2022.1 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pandas->trident==0.1.0) (2023.3)
Requirement already satisfied: iniconfig in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pytest->trident==0.1.0) (2.0.0)
Requirement already satisfied: pluggy<2.0,>=0.12 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pytest->trident==0.1.0) (1.3.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pytest->trident==0.1.0) (1.1.3)
Requirement already satisfied: tomli>=1.0.0 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from pytest->trident==0.1.0) (2.0.1)
Requirement already satisfied: zipp>=3.1.0 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from importlib-resources>=3.2.0->matplotlib->trident==0.1.0) (3.11.0)
Requirement already satisfied: six>=1.5 in /home/baron/anaconda3/envs/py38/lib/python3.8/site-packages (from python-dateutil>=2.7->matplotlib->trident==0.1.0) (1.16.0)
Building wheels for collected packages: trident
  Building editable for trident (pyproject.toml) ... done
  Created wheel for trident: filename=trident-0.1.0-0.editable-py3-none-any.whl size=6783 sha256=80404a44041fa2129ce95b642fbc8f18d77f665a21bc37cec771def9dc87cf22
  Stored in directory: /tmp/pip-ephem-wheel-cache-l3sz7f87/wheels/65/cb/8f/bf5271659251e361feab9cce4f28f60cb0319ca4ee41b4041a
Successfully built trident
Installing collected packages: trident
Successfully installed trident-0.1.0

💻 Requirements

  • Platform: Ubuntu 22.04.2 LTS(WSL2)
  • Version: Python 3.8.17, PyTorch 1.13.0

💬 Additional context

If I move the configs function (staticmethod) out of the GELU class, the error will disappear in that area.

@daemyung
Copy link
Contributor

daemyung commented Sep 2, 2023

@hotstone1993 Trident starts to support Python 3.8 from this commit. Could you test again on the latest?

@hotstone1993
Copy link
Author

It works very well in the latest version. thank you

@daemyung daemyung changed the title An error occurs when importing the Trident library. An error occurs when importing Trident Sep 4, 2023
@daemyung daemyung self-assigned this Sep 4, 2023
@daemyung daemyung added the help wanted Extra attention is needed label Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

2 participants