From ce8d7b6d118816313b1da733cdb5a29ec0cd686a Mon Sep 17 00:00:00 2001 From: Alan Du Date: Thu, 1 Aug 2024 10:18:15 -0700 Subject: [PATCH] Remove nest_asyncio from torchsnapshot Summary: This automatic monkey-patching is preventing `libfb.py.asyncio.await_utils.async_run` from working properly in Bento. Reviewed By: JKSenthil Differential Revision: D60545479 fbshipit-source-id: 695487d9efd6671a9d234ad2096ef25e97f183c7 --- requirements.txt | 1 - torchsnapshot/__init__.py | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7fa1db6..889a110 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ PyYAML aiofiles aiohttp importlib-metadata -nest_asyncio psutil pyre_extensions torch diff --git a/torchsnapshot/__init__.py b/torchsnapshot/__init__.py index 9314873..68c3925 100644 --- a/torchsnapshot/__init__.py +++ b/torchsnapshot/__init__.py @@ -15,26 +15,6 @@ from .stateful import Stateful from .version import __version__ - -def _is_notebook() -> bool: - try: - from IPython import get_ipython - - return ( - get_ipython().__class__.__name__ == "ZMQInteractiveShell" # Jupyter - or get_ipython().__class__.__module__ == "google.colab._shell" # Colab - ) - except ImportError: - return False - - -# https://github.com/jupyter/notebook/issues/3397 -if _is_notebook(): - # @manual=fbsource//third-party/pypi/nest-asyncio:nest-asyncio - import nest_asyncio # lint-fixme: DisallowNestAsyncio - - nest_asyncio.apply() - __all__ = [ "__version__", "Snapshot",