You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace GetLossClosure dispatcher with isinstance checks (#3235)
Summary:
Pull Request resolved: #3235
**Context**: See D96592835 for stack overview.
**This PR**:
This commit removes the GetLossClosure dispatcher in `get_loss_closure` and replaces it with isinstance checks for the `custom_loss` methods added in D96592835. . The routing logic is now:
1. Check for compute_loss protocol on MLL or model (added in commit 1)
2. If data_loader is provided, use _get_loss_closure_fallback_external
3. isinstance(mll, ExactMarginalLogLikelihood) -> _get_loss_closure_exact_internal
4. isinstance(mll, SumMarginalLogLikelihood) -> _get_loss_closure_sum_internal
5. Fallback -> _get_loss_closure_fallback_internal
Also cleans up:
- Removes unused type arguments (_: object, __: object, ___: None) from closure factory functions
- Removes **ignore: Any parameters that were only needed for dispatcher compatibility
- Removes **kwargs from get_loss_closure and get_loss_closure_with_grads (no callers pass extra kwargs)
- Removes imports of Dispatcher, type_bypassing_encoder, NoneType
Reviewed By: saitcakmak
Differential Revision: D96592824
fbshipit-source-id: 1a3672d9725ae3d27efb5bf78052ce18a9a5b0d7
0 commit comments