Skip to content

loadable

loadable

LoadableMixin

LoadableMixin(*args, rename: Optional[Dict[str, str]] = None, **kwargs)

Bases: NNsight

Mixin that adds model loading from an identifier (e.g. a repo ID or path).

Extends :class:NNsight so the first argument can be either a torch.nn.Module (wrapped directly) or an identifier that is resolved by :meth:_load.

Subclasses must implement :meth:_load to define how an identifier is converted into a torch.nn.Module.

PARAMETER DESCRIPTION
*args

If the first argument is a torch.nn.Module it is wrapped directly. Otherwise all arguments are forwarded to :meth:_load.

DEFAULT: ()

rename

Module path aliases. See :class:Envoy for details.

TYPE: Optional[Dict[str, str]] DEFAULT: None

**kwargs

Forwarded to :meth:_load when loading from an identifier.

DEFAULT: {}