apple / ml-cross-entropy

Other
178 stars 9 forks source link

AttributeError when importing cce_backward_kernel #6

Open NiuMa-1234 opened 6 days ago

NiuMa-1234 commented 6 days ago

Thank you for your wonderful job! I've been trying to reproduce the results but encountered an error, could you please help me ?The error happened at the importing stage and below is the detailed information:

[rank7]:     from cut_cross_entropy import linear_cross_entropy
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/cut_cross_entropy/__init__.py", line 2, in <module>
[rank7]:     from cut_cross_entropy.linear_cross_entropy import (
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/cut_cross_entropy/linear_cross_entropy.py", line 20, in <module>
[rank7]:     from cut_cross_entropy.cce import cce_linear_cross_entropy
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/cut_cross_entropy/cce.py", line 7, in <module>
[rank7]:     from cut_cross_entropy.cce_backward import cce_backward_kernel
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/cut_cross_entropy/cce_backward.py", line 81, in <module>
[rank7]:     def _cce_backward_kernel(
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/triton/runtime/jit.py", line 882, in jit
[rank7]:     return decorator(fn)
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/triton/runtime/jit.py", line 871, in decorator
[rank7]:     return JITFunction(
[rank7]:   File "/opt/conda/lib/python3.10/site-packages/triton/runtime/jit.py", line 717, in __init__
[rank7]:     self.src = self.src[re.search(r"^def\s+\w+\s*\(", self.src, re.MULTILINE).start():]
[rank7]: AttributeError: 'NoneType' object has no attribute 'start

And I found the self.src of this function(_cce_backward_kernel) is not its content but its decorator...

Would this relate to the conda environment? Any reply would be appreciated :D

BangguWu commented 2 days ago

I met the same problem, do you solved it? \n (I also saw your issue in triton.)

erikwijmans commented 1 day ago

What version of triton are you using? I think I have seen this before on older versions of triton.

NiuMa-1234 commented 14 hours ago

I met the same problem, do you solved it? \n (I also saw your issue in triton.)

No, I haven't...

NiuMa-1234 commented 14 hours ago

What version of triton are you using? I think I have seen this before on older versions of triton.

Hi, the version of the triton I use is 3.1.0, and my cuda version is 12.4, GPU: A800-SXM ,PyTorch: 2.5.1 , python: 3.10.9