Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

_VariableFunctions.pyi expands to invalid utf-8 encoding. #125320

Closed
lovettchris opened this issue May 1, 2024 · 1 comment
Closed

_VariableFunctions.pyi expands to invalid utf-8 encoding. #125320

lovettchris opened this issue May 1, 2024 · 1 comment
Labels
module: nn Related to torch.nn module: typing Related to mypy type annotations module: windows Windows support for PyTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@lovettchris
Copy link

lovettchris commented May 1, 2024

馃悰 Describe the bug

Torch 11.8 does not pass mypy 1.10.0 check, see python/mypy#17189

Looks like it is generated from _VariableFunctions.pyi.in

And the offset reported by mypy corresponds to line 6320 column 84 which contains these curly quotes:

image

Normally these would need to be utf-8 encoded, but in this case they are not and they are stored in the file as byte value 147 which is indeed an invalid utf-8 encoding. When encoded as utf-8 the curly braces become a 3 byte sequence 239, 191, 189. But it is a bit complicated figuring out where this is coming from - it appears this _VariableFunctions template is expanding a bunch of numpy functions, this one is the cov function. That function is in my env at D:\Anaconda3\envs\sr\Lib\site-packages\numpy\lib\function_base.py but the line containing that comment does not have curly quotes, so I'm not sure where the curly quotes are coming from.

Versions

Collecting environment information...
PyTorch version: 2.3.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Enterprise
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.28.0-msvc1
Libc version: N/A

Python version: 3.10.14 | packaged by Anaconda, Inc. | (main, Mar 21 2024, 16:20:14) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22631-SP0
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA T1000
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=3696
DeviceID=CPU0
Family=207
L2CacheSize=2560
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=3696
Name=Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
ProcessorType=3
Revision=

Versions of relevant libraries:
[pip3] flake8==7.0.0
[pip3] mypy==1.10.0
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] pytorch-lightning==2.2.3
[pip3] torch==2.3.0+cu118
[pip3] torchaudio==2.3.0+cu118
[pip3] torchmetrics==1.3.2
[pip3] torchvision==0.18.0+cu118
[conda] mkl 2021.4.0 pypi_0 pypi
[conda] numpy 1.26.4 pypi_0 pypi
[conda] pytorch-lightning 2.2.3 pypi_0 pypi
[conda] torch 2.3.0+cu118 pypi_0 pypi
[conda] torchaudio 2.3.0+cu118 pypi_0 pypi
[conda] torchmetrics 1.3.2 pypi_0 pypi
[conda] torchvision 0.18.0+cu118 pypi_0 pypi

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @ezyang @malfet @xuzhao9 @gramster @gqchen @pearu @nikitaved @soulitzer @lezcano @Varal7

@mikaylagawarecki mikaylagawarecki added module: autograd Related to torch.autograd, and the autograd engine in general module: nn Related to torch.nn triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: typing Related to mypy type annotations and removed module: autograd Related to torch.autograd, and the autograd engine in general labels May 1, 2024
@malfet malfet added the module: windows Windows support for PyTorch label May 2, 2024
@malfet
Copy link
Contributor

malfet commented May 2, 2024

Closing as duplicate of #124897

Fix has been pushed to trunk, will be cherry-picked into next patch release, but further work on investigating/preventing those regressions from happening is needed

@malfet malfet closed this as completed May 2, 2024
@malfet malfet closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: nn Related to torch.nn module: typing Related to mypy type annotations module: windows Windows support for PyTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants