From 9968edd00256fdb47e2e0129df918c5b23c06419 Mon Sep 17 00:00:00 2001 From: Tom Ritchford Date: Fri, 4 Jul 2025 15:22:25 +0000 Subject: [PATCH] Fix #153942 (#153943) Pull Request resolved: https://github.com/pytorch/pytorch/pull/153943 Approved by: https://github.com/malfet --- requirements.txt | 2 +- torch/__init__.py | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/requirements.txt b/requirements.txt index 18f7810de95..3698bfab1f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,4 @@ requests setuptools>=62.3.0,<80.0 sympy>=1.13.3 types-dataclasses -typing-extensions>=4.10.0 +typing-extensions>=4.13.2 diff --git a/torch/__init__.py b/torch/__init__.py index 0c54eb1a50b..3f2a2c0d963 100644 --- a/torch/__init__.py +++ b/torch/__init__.py @@ -32,7 +32,7 @@ from typing import ( TypeVar as _TypeVar, Union as _Union, ) -from typing_extensions import ParamSpec as _ParamSpec +from typing_extensions import ParamSpec as _ParamSpec, TypeIs as _TypeIs if TYPE_CHECKING: @@ -63,15 +63,7 @@ from torch._utils_internal import ( # TODO(torch_deploy) figure out how to freeze version.py in fbcode build if _running_with_deploy(): __version__ = "torch-deploy-1.8" - # TODO: Remove this ugly hack when deploy typing extensions are updated to 4.10+ - if not TYPE_CHECKING: - import typing_extensions - - _TypeIs = typing_extensions.TypeGuard - typing_extensions.TypeIs = _TypeIs else: - from typing_extensions import TypeIs as _TypeIs - from torch.torch_version import __version__ as __version__ __all__ = [