-
Notifications
You must be signed in to change notification settings - Fork 24.2k
torch.compile fails for some torch.script.jit wrapped class method with 'torch._C.ScriptFunction' object has no attribute '__name__' #153607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can't repro on the nightly - this was probably fixed. Can you check if you can repro on your original code on the nightly? |
The error changed to a warning on nightly.
nighly envCollecting environment information... OS: Fedora Linux 41 (KDE Plasma) (x86_64) Python version: 3.13.3 experimental free-threading build | packaged by conda-forge | (main, Apr 14 2025, 20:49:24) [GCC 13.3.0] (64-bit runtime) CPU: Versions of relevant libraries: |
This graph break is happening because we're doing some shortcuts in variable tracking during the attribute access: pytorch/torch/_dynamo/variables/user_defined.py Line 1163 in 084c4aa
As an immediate workaround, you can try moving the static method outside the class or changing the static method to a class method. |
cc @anijain2305 @StrongerXi another case where we should consider going through variable builder. |
🐛 Describe the bug
torch.compile fails for this common way of speeding up code with torch.script.jit, with error message
'torch._C.ScriptFunction' object has no attribute '__name__'
reproducer
Full Error
Versions
Collecting environment information...
PyTorch version: 2.6.0
Is debug build: False
CUDA used to build PyTorch: 12.6
ROCM used to build PyTorch: N/A
OS: Fedora Linux 41 (KDE Plasma) (x86_64)
GCC version: (conda-forge gcc 13.3.0-1) 13.3.0
Clang version: 19.1.7 (Fedora 19.1.7-3.fc41)
CMake version: version 3.30.8
Libc version: glibc-2.40
Python version: 3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:24:40) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.14.5-200.fc41.x86_64-x86_64-with-glibc2.40
Is CUDA available: True
CUDA runtime version: 12.8.61
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce MX550
Nvidia driver version: 570.144
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: GenuineIntel
Model name: 12th Gen Intel(R) Core(TM) i5-12500H
CPU family: 6
Model: 154
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 1
Stepping: 3
CPU(s) scaling MHz: 37%
CPU max MHz: 4500.0000
CPU min MHz: 400.0000
BogoMIPS: 6220.80
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 448 KiB (12 instances)
L1i cache: 640 KiB (12 instances)
L2 cache: 9 MiB (6 instances)
L3 cache: 18 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Ghostwrite: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Mitigation; Clear Register File
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] mypy_extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] numpy-groupies==0.11.2
[pip3] numpydoc==1.8.0
[pip3] onnx==1.17.0
[pip3] optree==0.15.0
[pip3] torch==2.6.0
[pip3] torch_scatter==2.1.2
[pip3] torch_sparse==0.6.18
[pip3] torchvision==0.21.0
[pip3] torchvision-extra-decoders==0.0.2
[pip3] triton==3.2.0+git576374f8
[conda] Could not collect
cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @chauhang @penguinwu @voznesenskym @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @chenyang78 @kadeng @amjames
The text was updated successfully, but these errors were encountered: