Fix: Respect mask_ratio=0.0 in PrithviMAE.forward#1167
Conversation
|
Thanks @akshanthsaik will look into it |
There was a problem hiding this comment.
Pull request overview
This PR updates PrithviMAE.forward to treat mask_ratio=0.0 as a valid value by replacing a truthiness-based defaulting check with an explicit None check.
Changes:
- Replace
mask_ratio = mask_ratio or self.mask_ratiowith an explicitNonefallback to preserve0.0.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Added a guard in forward_loss to handle mask_sum==0, which occurs when mask_ratio=0.0, preventing division by zero and NaNs. |
|
Just realised, |
|
@ahmedemam576 reviewing |
|
Addressed the reviews of copilot in 7de1639
|
|
Thanks @akshanthsaik — reviewed. The core fix is correct: the One thing worth aligning on before merge: Does raising on Minor: the error message ("Use a mask_ratio > 0.0 for training") is a bit training-specific given No blocking correctness issues — just want to make sure we're closing #1096 the way the reporter expected. |
|
Thanks, @romeokienzler I agree, for MAE models, mask_ratio=0.0 is useful in inference (full-image reconstruction/features) but not in training.
Does that match what you expect, or do you prefer a different approach? |
Replaced the truthiness check with an explicit None check so that 0.0 is treated as a valid.