fluke.config
¶
Fluke configuration class. |
|
Exception raised when the configuration is not valid. |
|
This class is used to configure the optimizer and the learning rate scheduler. |
class fluke.config.Configuration
- class fluke.config.Configuration(config_exp_path: str = None, config_alg_path: str = None, force_validation: bool = True)[source]¶
Fluke configuration class. This class is used to store the configuration of an experiment. The configuration must adhere to a specific structure. The configuration is validated when the class is instantiated.
- Parameters:
- Raises:
ValueError – If the configuration is not valid.
- property client: DDict¶
Get quick access to the client’s hyperparameters.
- Returns:
The client’s hyperparameters.
- Return type:
- classmethod from_dict(cfg_dict: dict | DictConfig) Configuration [source]¶
Create a configuration from a dictionary.
- Parameters:
cfg_dict (dict | DictConfig) – The dictionary.
- Returns:
The configuration.
- Return type:
- property model: DDict¶
Get quick access to the model hyperparameters.
- Returns:
The model hyperparameters.
- Return type:
- property server: DDict¶
Get quick access to the server’s hyperparameters.
- Returns:
The server’s hyperparameters.
- Return type:
- classmethod sweep(config_exp_path: str, config_alg_path: str) list[Configuration] [source]¶
Generate configurations from a sweep. This method is used to generate configurations from a sweep. The sweep is defined by the experiment configuration file. The method yields a configuration for each combination of hyperparameters.
- Parameters:
- Returns:
A list of configurations.
- Return type:
class fluke.config.ConfigurationError
- class fluke.config.ConfigurationError[source]¶
Exception raised when the configuration is not valid.
class fluke.config.OptimizerConfigurator
- class fluke.config.OptimizerConfigurator(optimizer_cfg: DDict | dict, scheduler_cfg: DDict | dict = None)[source]¶
This class is used to configure the optimizer and the learning rate scheduler.
- __call__(model: Module, filter_fun: callable | None = None, **override_kwargs)[source]¶
Creates the optimizer and the scheduler.
- Parameters:
model (Module) – The model whose parameters will be optimized.
filter_fun (callable) – This must be a function of the model and it must returns the set of parameters that the optimizer will consider.
override_kwargs (dict) – The optimizer’s keyword arguments to override the default ones.
- Returns:
The optimizer and the scheduler.
- Return type:
tuple[Optimizer, StepLR]