Skip to content

v0.18.2

Latest

Choose a tag to compare

@ValerianRey ValerianRey released this 22 Nov 13:05
· 1 commit to main since this release
3a95c4f

🥭 Device and autojac fixes

This patch makes .to() move the tensors given to many aggregators, weightings and scalarizers (Constant, UPGrad, DualProj, STCH, ...), and fixes jac_to_grad with repeated tensors and backward / mtl_backward with expanded .jac or .grad fields. Thanks a lot to @SajalDevX for all these fixes!

Changelog

Fixed

  • Fixed .to() not moving the tensors given to the Constant, STCH, PBI and COSMOS scalarizers (weights and reference). These tensors are now registered as non-persistent buffers, so they follow the dtype and device of the scalarizer without being added to its state_dict. FAMO's min_losses buffer is also no longer in its state_dict.
  • Fixed .to() not moving the tensors given to Constant, ConstantWeighting, UPGrad, UPGradWeighting, DualProj, DualProjWeighting, AlignedMTL, AlignedMTLWeighting, ConFIG, SDMGradWeighting, CRMOGMWeighting and GradDrop (weights, pref_vector, initial_weights and leak). These tensors are now registered as non-persistent buffers, so they follow the dtype and device of the aggregator or weighting without being added to its state_dict.
  • Fixed jac_to_grad failing with an AttributeError (or, with retain_jac=True, accumulating a wrong gradient) when a tensor is repeated in tensors. Repeated tensors are now only considered once.
  • Fixed backward and mtl_backward failing with a RuntimeError when the .jac or .grad field held an expanded tensor (e.g. when a parameter is directly summed into a loss) and was then accumulated into by another call, or when such a .grad was modified in-place (e.g. with clip_grad_norm_). Expanded gradients are now materialized before being stored in .grad, and an expanded .jac is now only materialized when another Jacobian is accumulated into it.