Apply the gradients to the parameters of the model and update the model with the new parameters. Args: model (mlx.nn.Module): An mlx module to be updated. gradients (dict): A Python tree of gradients, most likely computed via :fu
(self, model: Module, gradients: dict)
| 18 | self._schedulers = {k: v for k, v in (schedulers or {}).items()} |
| 19 | |
| 20 | def update(self, model: Module, gradients: dict): |
| 21 | """Apply the gradients to the parameters of the model and update the |
| 22 | model with the new parameters. |
| 23 | |
| 24 | Args: |
| 25 | model (mlx.nn.Module): An mlx module to be updated. |
| 26 | gradients (dict): A Python tree of gradients, most likely computed |
| 27 | via :func:`mlx.nn.value_and_grad`. |
| 28 | """ |
| 29 | model.update(self.apply_gradients(gradients, model)) |
| 30 | |
| 31 | def init(self, parameters: dict): |
| 32 | """Initialize the optimizer's state |
nothing calls this directly
no test coverage detected