get_module
Factory functions for lightning modules.
create_module(algorithm_config) #
Initialize the correct Lightning module from an algorithm config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm_config | UNetBasedAlgorithm | The pydantic model with algorithm specific parameters. | required |
Returns:
| Type | Description |
|---|---|
CAREamicsModule | A lightning module for running one of the algorithms supported by CAREamics. |
Raises:
| Type | Description |
|---|---|
NotImplementedError | If the chosen algorithm is not yet supported. |
Source code in src/careamics/lightning/dataset_ng/lightning_modules/get_module.py
get_module_cls(algorithm) #
Get the lightning module class for the specified algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm | SupportedAlgorithm | One of the algorithms supported by CAREamics, e.g. | required |
Returns:
| Type | Description |
|---|---|
CAREamicsModuleCls | A Lightning module class for running the specified |
Raises:
| Type | Description |
|---|---|
NotImplementedError | If the chosen algorithm is not get supported. |
Source code in src/careamics/lightning/dataset_ng/lightning_modules/get_module.py
load_module_from_checkpoint(checkpoint_path) #
Load a trained CAREamics module from checkpoint.
Automatically detects the algorithm type from the checkpoint and loads the appropriate module with trained weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path | Path | Path to the PyTorch Lightning checkpoint file. | required |
Returns:
| Type | Description |
|---|---|
CAREamicsModule | Lightning module with loaded weights. |
Raises:
| Type | Description |
|---|---|
ValueError | If the algorithm type cannot be determined from the checkpoint. |