Skip to content

Commit

Permalink
Remove nest_asyncio from torchsnapshot
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alanhdu authored and facebook-github-bot committed Aug 1, 2024
1 parent e8a1fc0 commit ce8d7b6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ PyYAML
aiofiles
aiohttp
importlib-metadata
nest_asyncio
psutil
pyre_extensions
torch
Expand Down
20 changes: 0 additions & 20 deletions torchsnapshot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ce8d7b6

Please sign in to comment.