server icon indicating copy to clipboard operation
server copied to clipboard

module 'triton' has no attribute 'language'

Open NguyenThanhHa288 opened this issue 1 year ago • 1 comments

I'm getting the error message "AttributeError: module 'triton' has no attribute 'language'" when I update the triton library from version 2.47.0 to 2.48.0.

NguyenThanhHa288 avatar Jul 30 '24 15:07 NguyenThanhHa288

Hi @NguyenThanhHa288, can you share more details on how you're installing and what code you're writing that is generating this error?

Please provide the minimal steps to reproduce this error.

rmccorm4 avatar Jul 31 '24 22:07 rmccorm4

Same issue here with torch-2.4.0

File "/home/michael/.local/lib/python3.10/site-packages/torch/_dynamo/init.py", line 2, in from . import convert_frame, eval_frame, resume_execution File "/home/michael/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 40, in from . import config, exc, trace_rules File "/home/michael/.local/lib/python3.10/site-packages/torch/_dynamo/exc.py", line 11, in from .utils import counters File "/home/michael/.local/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1008, in common_constant_types.add(triton.language.dtype) AttributeError: module 'triton' has no attribute 'language'

msoftware avatar Sep 12 '24 11:09 msoftware

I got the same issue with @msoftware, this error comes from common_constant_types.add(triton.language.dtype),to reproduce this error, just execute from torchvision import transforms, my torchvision verison is 0.19.1

wwdok avatar Sep 18 '24 07:09 wwdok

Hi, this looks like use of OpenAI Triton, and not NVIDIA Triton Inference Server. Please raise an issue here: https://github.com/triton-lang/triton

rmccorm4 avatar Sep 18 '24 18:09 rmccorm4

same error code is

triton_server_url = 'xxxxxxx:8003'
triton_client = InferenceServerClient(url=triton_server_url, verbose=False, ssl=False)


if triton_client.is_model_ready(model_name):

    # Load the Triton Server model
    model = YOLO(f"http://{triton_server_url}/yolov8x", task="detect")

    # Run inference on the server
    results = model.predict(r"E:\code\images\val\frame_027940.PNG")
    for r in results:
        print(f"Detected {len(r)} objects in image")

error is

Traceback (most recent call last):
  File "E:\code\cards\api\test_triton.py", line 15, in <module>
    results = model.predict(r"E:\code\cards\train\datasets\221319\images\val\frame_027940.PNG")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\ultralytics\engine\model.py", line 554, in predict
    return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream)
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\ultralytics\engine\predictor.py", line 168, in __call__
    return list(self.stream_inference(source, model, *args, **kwargs))  # merge list of Result into one
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\torch\utils\_contextlib.py", line 36, in generator_context
    response = gen.send(None)
               ^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\ultralytics\engine\predictor.py", line 234, in stream_inference
    self.model.warmup(imgsz=(1 if self.model.pt or self.model.triton else self.dataset.bs, 3, *self.imgsz))
  File "E:\miniconda\envs\card\Lib\site-packages\ultralytics\nn\autobackend.py", line 642, in warmup
    import torchvision  # noqa (import here so torchvision import time not recorded in postprocess time)
    ^^^^^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\__init__.py", line 10, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils  # usort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\models\__init__.py", line 2, in <module>
    from .convnext import *
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\models\convnext.py", line 8, in <module>
    from ..ops.misc import Conv2dNormActivation, Permute
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\ops\__init__.py", line 23, in <module>
    from .poolers import MultiScaleRoIAlign
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\ops\poolers.py", line 10, in <module>
    from .roi_align import roi_align
  File "E:\miniconda\envs\card\Lib\site-packages\torchvision\ops\roi_align.py", line 7, in <module>
    from torch._dynamo.utils import is_compile_supported
  File "E:\miniconda\envs\card\Lib\site-packages\torch\_dynamo\__init__.py", line 2, in <module>
    from . import convert_frame, eval_frame, resume_execution
  File "E:\miniconda\envs\card\Lib\site-packages\torch\_dynamo\convert_frame.py", line 48, in <module>
    from . import config, exc, trace_rules
  File "E:\miniconda\envs\card\Lib\site-packages\torch\_dynamo\exc.py", line 12, in <module>
    from .utils import counters
  File "E:\miniconda\envs\card\Lib\site-packages\torch\_dynamo\utils.py", line 1066, in <module>
    common_constant_types.add(triton.language.dtype)
                              ^^^^^^^^^^^^^^^
AttributeError: module 'triton' has no attribute 'language'
torch                     2.4.1
torchvision               0.19.1
tqdm                      4.66.5
tritonclient              2.51.0

server_version 2.50.0

jaffe-fly avatar Nov 01 '24 08:11 jaffe-fly

so sorry ,in my project,there is a dir named triton, its a bad dirname,after refactor it ,is ok

jaffe-fly avatar Nov 01 '24 09:11 jaffe-fly