Torch: reject unknown scaling values instead of silent NOPScaler#3293
Open
shaun0927 wants to merge 1 commit intoawslabs:devfrom
Open
Torch: reject unknown scaling values instead of silent NOPScaler#3293shaun0927 wants to merge 1 commit intoawslabs:devfrom
shaun0927 wants to merge 1 commit intoawslabs:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: follow-up to #3251
Description of changes:
Since #3251, the DL estimator modules (
patch_tst,lag_tst,d_linear,tide) acceptscaling: Optional[str], with"mean"and"std"each picking a scaler andNoneintentionally falling back toNOPScaler. The current control flow is:The final
elsematches both the intendedNoneopt-out and any typo or unsupported value ("standard","minmax","mean ", …). Users who mistype silently get un-scaled inputs with no warning, and the combination ofNOPScaler+StudentTOutputis exactly the NaN pathway that #3265 now has to recover from at training time.This PR keeps the
Noneopt-out, but raisesValueErrorfor any other string. The fix is four identical blocks, one per module:Trade-offs considered
Literal["mean", "std"](pydantic would reject at construction): rejected. It would change the serialized representation for existing users and any saved predictor JSON that storedscaling: "mean"as a plain string. The runtimeValueErrorpath is lower blast-radius and catches the same garbage.Verification
All four estimators were instantiated and
create_lightning_module()called for each of"mean","std",None, and"garbage_value":By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup