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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show pytorch adapter even if torch in not imported. #234

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 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 @@ -34,19 +29,15 @@


class ExtensionManager(object, metaclass=Singleton):
BUILTIN_ADAPTER_MODULES: list[str] = (
[
'.builtin_tflite_flatbuffer_adapter',
'.builtin_tflite_mlir_adapter',
'.builtin_tf_mlir_adapter',
'.builtin_tf_direct_adapter',
'.builtin_graphdef_adapter',
]
+ (['.builtin_pytorch_exportedprogram_adapter'] if torch else [])
+ [
'.builtin_mlir_adapter',
]
)
BUILTIN_ADAPTER_MODULES: list[str] = [
'.builtin_tflite_flatbuffer_adapter',
'.builtin_tflite_mlir_adapter',
'.builtin_tf_mlir_adapter',
'.builtin_tf_direct_adapter',
'.builtin_graphdef_adapter',
'.builtin_pytorch_exportedprogram_adapter',
'.builtin_mlir_adapter',
]

CACHED_REGISTERED_EXTENSIONS: Dict[str, RegisteredExtension] = {}

Expand Down