model¶
Base class(es) for building models.
- class graphnet.models.model.Model(*args, **kwargs)[source]¶
Bases:
Logger
,Configurable
,LightningModule
,ABC
Base class for all components in graphnet.
Construct Logger.
- Parameters:
args (Any)
kwargs (Any)
- Return type:
object
- verbose_print = True¶
- save_state_dict(path)[source]¶
Save model state_dict to path.
- Return type:
None
- Parameters:
path (str)
- load_state_dict(path, **kargs)[source]¶
Load model state_dict from path.
- Return type:
- Parameters:
path (str | Dict)
kargs (Any | None)
- classmethod from_config(source, trust, load_modules)[source]¶
Construct Model instance from source configuration.
- Parameters:
trust (
bool
, default:False
) – Whether to trust the ModelConfig file enough to eval(…) any lambda function expressions contained.load_modules (
Optional
[List
[str
]], default:None
) – List of modules used in the definition of the model which, as a consequence, need to be loaded into the global namespace. Defaults to loading torch.source (ModelConfig | str)
- Raises:
ValueError – If the ModelConfig contains lambda functions but trust = False.
- Return type:
- set_verbose_print_recursively(verbose_print)[source]¶
Set verbose_print recursively for all Model modules.
- Return type:
None
- Parameters:
verbose_print (bool)