pyprobound.base.Spec
- class Spec(name='')
Bases:
ComponentA component that stores experiment-independent parameters.
The forward implementation should be left to the experiment-specific implementation (either a Layer or Cooperativity component).
- __init__(name='')
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Methods
check_length_consistency()Checks that input lengths of Binding components are consistent.
Iterator of child components.
forward()Define the computation performed at every call.
freeze()Turns off gradient calculation for all parameters.
max_embedding_size()The maximum number of bytes needed to encode a sequence.
optim_procedure([ancestry, current_order])The sequential optimization procedure for all Binding components.
reload(checkpoint)Loads the model from a checkpoint file.
reload_from_state_dict(state_dict)Loads the model from a state dict.
save(checkpoint[, flank_lengths])Saves the model to a file with "state_dict" and "metadata" fields.
unfreeze([parameter])Turns on gradient calculation for the specified parameter.
update_binding_optim(binding_optim)Updates a BindingOptim with the specification's optimization steps.
Attributes
unfreezablealias of
Literal['all']Non-Inherited Members
- forward()
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
NoneNote
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- update_binding_optim(binding_optim)
Updates a BindingOptim with the specification’s optimization steps.
- Parameters:
binding_optim (
BindingOptim) – The parent BindingOptim to be updated.- Return type:
- Returns:
The updated BindingOptim.