ml_switcheroo.frameworks.base¶
Base Protocol and Registry for Framework Adapters.
This module defines the interface that all Framework Adapters must implement. It acts as the primary contact point between the ASTEngine and the specific ML library implementations (plugins).
Key Capabilities (Hybrid Loading): - Adapters possess an init_mode (LIVE or GHOST). - In LIVE mode, they introspect installed packages. - In GHOST mode, they load cached JSON snapshots.
Update: Enhanced StandardMap schema and import definitions.
Attributes¶
Classes¶
str(object='') -> str |
|
str(object='') -> str |
|
Defines how a Framework implements a Middle Layer standard. |
|
Protocol definition for a Framework Adapter. |
Functions¶
|
Locates the most recent snapshot for a given framework key. |
|
|
|
Module Contents¶
- ml_switcheroo.frameworks.base.SNAPSHOT_DIR¶
- class ml_switcheroo.frameworks.base.StandardCategory¶
Bases:
str,enum.Enumstr(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- LOSS = 'loss'¶
- OPTIMIZER = 'optimizer'¶
- LAYER = 'layer'¶
- ACTIVATION = 'activation'¶
- class ml_switcheroo.frameworks.base.InitMode¶
Bases:
str,enum.Enumstr(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- LIVE = 'live'¶
- GHOST = 'ghost'¶
- class ml_switcheroo.frameworks.base.StandardMap(/, **data: Any)¶
Bases:
pydantic.BaseModelDefines how a Framework implements a Middle Layer standard. Used for declaring static definitions in adapters.
- api: str = None¶
- args: Dict[str, str] | None = None¶
- inject_args: Dict[str, str | int | float | bool] | None = None¶
- requires_plugin: str | None = None¶
- output_adapter: str | None = None¶
- transformation_type: str | None = None¶
- operator: str | None = None¶
- pack_to_tuple: str | None = None¶
- macro_template: str | None = None¶
- output_cast: str | None = None¶
- class ml_switcheroo.frameworks.base.FrameworkAdapter¶
Bases:
ProtocolProtocol definition for a Framework Adapter.
- convert(data: Any) Any¶
- property test_config: Dict[str, str]¶
- property search_modules: List[str]¶
- property display_name: str¶
- property ui_priority: int¶
- property discovery_heuristics: Dict[str, List[str]]¶
- property supported_tiers: List[ml_switcheroo.enums.SemanticTier]¶
- property import_alias: Tuple[str, str]¶
- property inherits_from: str | None¶
- property structural_traits: ml_switcheroo.semantics.schema.StructuralTraits¶
- property rng_seed_methods: List[str]¶
- get_device_syntax(device_type: str, device_index: str | None = None) str¶
- get_serialization_syntax(op: str, file_arg: str, object_arg: str | None = None) str¶
- get_serialization_imports() List[str]¶
- classmethod get_example_code() str¶
- get_tiered_examples() Dict[str, str]¶
- property definitions: Dict[str, StandardMap]¶
Returns the framework’s static implementation of Middle Layer Operations.
- property import_namespaces: Dict[str, Dict[str, str]]¶
Returns import path remapping rules. Format: {“source.mod”: {“root”: “target”, “sub”: “mod”, “alias”: “alias”}}
- collect_api(category: StandardCategory) List[ml_switcheroo.core.ghost.GhostRef]¶
- apply_wiring(snapshot: Dict[str, Any]) None¶
- ml_switcheroo.frameworks.base.load_snapshot_for_adapter(fw_key: str) Dict[str, Any]¶
Locates the most recent snapshot for a given framework key.
- ml_switcheroo.frameworks.base.register_framework(name: str)¶
- ml_switcheroo.frameworks.base.get_adapter(name: str) FrameworkAdapter | None¶