Description
🐛 Describe the bug
When importing 'torch' in grad_mode.py
, it is imported as a NoneType, and the line
if not torch._jit_internal.is_scripting():
causes the following error:
Traceback (most recent call last):
File "E:\Coding\.venv\lib\site-packages\torch\utils\_contextlib.py", line 45, in generator_context
File "E:\Coding\.venv\lib\site-packages\torch\utils\_contextlib.py", line 148, in clone
File "E:\Coding\.venv\lib\site-packages\torch\autograd\grad_mode.py", line 76, in __init__
AttributeError: 'NoneType' object has no attribute '_jit_internal'
These are the imports found in grad_mode.py
:
from typing import Any, Union
import torch
from torch.utils._contextlib import (
_DecoratorContextManager,
_NoParamDecoratorContextManager,
F,
)
Is this an issue with the compiler?
Versions
PyTorch version: 2.7.0+cu126
Is debug build: False
CUDA used to build PyTorch: 12.6
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 11 Pro (10.0.26100 64-bit)
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A
Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.26100-SP0
Is CUDA available: True
CUDA runtime version: 12.9.41
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4080 Laptop GPU
Nvidia driver version: 576.52
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Name: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Manufacturer: AuthenticAMD
Family: 107
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 4001
MaxClockSpeed: 4001
L2CacheSize: 8192
L2CacheSpeed: None
Revision: 29697
Versions of relevant libraries:
[pip3] numpy==2.2.6
[pip3] >
[pip3] pytorch-lightning==2.5.1.post0
[pip3] pytorch-wpe==0.0.1
[pip3] torch==2.7.0+cu126
[pip3] torch-complex==0.4.4
[pip3] torchaudio==2.7.0+cu126
[pip3] torchmetrics==1.7.1
[pip3] torchvision==0.22.0+cu126
[pip3] triton-windows==3.3.0.post19
[conda] Could not collect
cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @ezyang @albanD @gqchen @nikitaved @soulitzer @Varal7 @xmfan
Metadata
Metadata
Assignees
Labels
Type
Projects
Status