vision_unlearning.utils.gradient_weighting ========================================== .. py:module:: vision_unlearning.utils.gradient_weighting Attributes ---------- .. autoapisummary:: vision_unlearning.utils.gradient_weighting.logger Classes ------- .. autoapisummary:: vision_unlearning.utils.gradient_weighting.GradientWeightingMethod vision_unlearning.utils.gradient_weighting.GradientWeightingMethodNone vision_unlearning.utils.gradient_weighting.GradientWeightingMethodSimple vision_unlearning.utils.gradient_weighting.GradientWeightingMethodMunba Module Contents --------------- .. py:data:: logger .. py:class:: GradientWeightingMethod(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`abc.ABC` Method used to conciliate/harmonize/combine/weight the gradients of the different tasks Inspired by @article{navon2022multi, title={Multi-Task Learning as a Bargaining Game}, author={Navon, Aviv and Shamsian, Aviv and Achituve, Idan and Maron, Haggai and Kawaguchi, Kenji and Chechik, Gal and Fetaya, Ethan}, journal={arXiv preprint arXiv:2202.01017}, year={2022} } Source: https://github.com/AvivNavon/nash-mtl/blob/main/methods/weight_methods.py .. py:method:: weight_grads(grads_forget: List[torch.Tensor], grads_retain: List[torch.Tensor], accelerator) -> torch.Tensor :abstractmethod: @return scaled_grad .. py:class:: GradientWeightingMethodNone(/, **data: Any) Bases: :py:obj:`GradientWeightingMethod` No weighting is applied, takes just the forget gradients For debugging/comparison purposes .. py:method:: weight_grads(grads_forget: List[torch.Tensor], grads_retain: List[torch.Tensor], accelerator) -> torch.Tensor @return scaled_grad .. py:class:: GradientWeightingMethodSimple(/, **data: Any) Bases: :py:obj:`GradientWeightingMethod` Fixed weights for each component .. py:attribute:: forget_weight :type: float :value: 1.0 .. py:attribute:: retain_weight :type: float :value: 1.0 .. py:method:: weight_grads(grads_forget: List[torch.Tensor], grads_retain: List[torch.Tensor], accelerator) -> torch.Tensor @return scaled_grad .. py:class:: GradientWeightingMethodMunba(/, **data: Any) Bases: :py:obj:`GradientWeightingMethod` Inspired by @misc{wu2025munbamachineunlearningnash, title={MUNBa: Machine Unlearning via Nash Bargaining}, author={Jing Wu and Mehrtash Harandi}, year={2025}, eprint={2411.15537}, archivePrefix={arXiv}, primaryClass={cs.CV}, url={https://arxiv.org/pdf/2411.15537v1}, } The closed-form solution is implemented as described in the V1 of the paper. .. py:method:: weight_grads(grads_forget: List[torch.Tensor], grads_retain: List[torch.Tensor], accelerator) -> torch.Tensor @return scaled_grad