-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Description
🐛 Describe the bug
On Windows platforms, PyTorch 2.3.0 causes mypy to fail with the following error messages:
mypy: can't decode file '.venv\Lib\site-packages\torch\_C\_VariableFunctions.pyi': 'utf-8' codec can't decode byte 0x93 in position 290995: invalid start byte
mypy: can't decode file '.venv\Lib\site-packages\torch\_VF.pyi': 'utf-8' codec can't decode byte 0x93 in position 290995: invalid start byte
Inspecting _VariableFunctions.pyi and _VF.pyi reveals that the files are encoded with Latin1 encoding instead of UTF-8 like the rest of the pyi files. Looking deeper at the contents of the wheel obtained from https://download.pytorch.org/whl/cu121/torch-2.3.0%2Bcu121-cp311-cp311-win_amd64.whl shows that the files are incorrectly encoded there as well. It is important to note that PyTorch 2.2.2 does not have this problem. It was introduced in 2.3.0.
As a workaround, the files can be re-encoded to UTF-8, which allows mypy to work correctly.
Versions
PyTorch version: 2.3.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 11 Enterprise
GCC version: Could not collect
Clang version: 17.0.1
CMake version: version 3.27.4
Libc version: N/A
Python version: 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22631-SP0
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1650
Nvidia driver version: 552.22
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture=9
CurrentClockSpeed=4701
DeviceID=CPU0
Family=107
L2CacheSize=12288
L2CacheSpeed=
Manufacturer=AuthenticAMD
MaxClockSpeed=4701
Name=AMD Ryzen 9 7900X 12-Core Processor
ProcessorType=3
Revision=24834
Versions of relevant libraries:
[pip3] mypy==1.10.0
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] onnx==1.16.0
[pip3] onnxruntime==1.17.3
[pip3] torch==2.3.0+cu121
[pip3] torchvision==0.18.0+cu121
[conda] Could not collect
cc @seemethere @malfet @osalpekar @atalman @ezyang @xuzhao9 @gramster