Skip to content

Commit

Permalink
Show pytorch adapter even if torch in not impoted.
Browse files Browse the repository at this point in the history
Just realized that it is useful to show that the pytorch adapter is available even if torch is not imported. We will display 'torch not installed' error message when user actually uses the adapter.
  • Loading branch information
jinjingforever committed Nov 4, 2024
1 parent 6aa67b6 commit 4ee6066
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/server/package/src/model_explorer/extension_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
from importlib import import_module
from typing import Any, Dict, Union

try:
import torch
except ImportError:
torch = None

from .adapter_runner import AdapterRunner
from .consts import MODULE_NAME
from .extension_class_processor import ExtensionClassProcessor
Expand All @@ -41,9 +36,7 @@ class ExtensionManager(object, metaclass=Singleton):
'.builtin_tf_mlir_adapter',
'.builtin_tf_direct_adapter',
'.builtin_graphdef_adapter',
]
+ (['.builtin_pytorch_exportedprogram_adapter'] if torch else [])
+ [
'.builtin_pytorch_exportedprogram_adapter',
'.builtin_mlir_adapter',
]
)
Expand Down

0 comments on commit 4ee6066

Please sign in to comment.