p2pfl.learning.frameworks.pytorch.lightning_model moduleΒΆ
Convolutional Neural Network (for MNIST) with PyTorch Lightning.
- class p2pfl.learning.frameworks.pytorch.lightning_model.LightningModel(model, params=None, num_samples=None, contributors=None, additional_info=None, compression=None)[source]ΒΆ
Bases:
P2PFLModel
P2PFL model abstraction for PyTorch Lightning.
- Parameters:
model (
LightningModule
) β The model to encapsulate.params (
Union
[list
[ndarray
],bytes
,None
]) β The parameters of the model.num_samples (
Optional
[int
]) β The number of samples.contributors (
Optional
[list
[str
]]) β The contributors of the model.additional_info (
Optional
[dict
[str
,Any
]]) β Additional information.compression (
Optional
[dict
[str
,dict
[str
,Any
]]]) β Optional dictionary for compression settings.
- get_framework()[source]ΒΆ
Retrieve the model framework name.
- Return type:
str
- Returns:
The name of the model framework.
- get_parameters()[source]ΒΆ
Get the parameters of the model.
- Return type:
List
[ndarray
]- Returns:
The parameters of the model
- set_parameters(params)[source]ΒΆ
Set the parameters of the model.
- Parameters:
params (
Union
[List
[ndarray
],bytes
]) β The parameters of the model.- Raises:
ModelNotMatchingError β If parameters donβt match the model.
- Return type:
None